Dezibot 4
Loading...
Searching...
No Matches
Upside_Downside_Detection.ino
Go to the documentation of this file.
1#include "Dezibot.h"
2Dezibot dezibot = Dezibot();
3void setup() {
4 // put your setup code here, to run once:
5 dezibot.begin();
6 Serial.begin(115200);
7}
8
9int indices = 0;
10void loop() {
11 // put your main code here, to run repeatedly:
12
13
14 int zvalue = 0;
15 for(int i = 0; i<30;i++){
16 zvalue += dezibot.motion.detection.getAcceleration().z;
17 }
18 zvalue = zvalue/30;
19 if(zvalue < -1700){
20 dezibot.multiColorLight.setLed(ALL,0x00FF00);
21 } else if(zvalue > 1700){
22 dezibot.multiColorLight.setLed(ALL,0xFF0000);
23 } else {
24 dezibot.multiColorLight.turnOffLed();
25 }
26 }
27