Dezibot 4
Loading...
Searching...
No Matches
tilt_detection.ino
Go to the documentation of this file.
1#include "Dezibot.h"
2
3Dezibot dezibot = Dezibot();
4
5void setup() {
6 // put your setup code here, to run once:
7 Serial.begin(115200);
8 dezibot.begin();
9}
10
11void loop() {
12 switch (dezibot.motion.detection.getTiltDirection()) {
13 case Front:
14 dezibot.multiColorLight.setTopLeds(GREEN);
15 break;
16 case Left:
17 dezibot.multiColorLight.setTopLeds(YELLOW);
18 break;
19 case Right:
20 dezibot.multiColorLight.setTopLeds(TURQUOISE);
21 break;
22 case Back:
23 dezibot.multiColorLight.setTopLeds(BLUE);
24 break;
25 case Flipped:
26 dezibot.multiColorLight.setTopLeds(PINK);
27 break;
28 case Neutral:
29 dezibot.multiColorLight.turnOffLed();
30 break;
31
32 case Error:
33 dezibot.multiColorLight.setTopLeds(RED);
34 break;
35 }
36 delay(100);
37}