mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-21 20:11:46 +02:00
added example for tiltdetection
This commit is contained in:
parent
14de5a626e
commit
080563f6cc
37
example/IMU/Tilt_Detection/tilt_detection/tilt_detection.ino
Normal file
37
example/IMU/Tilt_Detection/tilt_detection/tilt_detection.ino
Normal file
@ -0,0 +1,37 @@
|
||||
#include "Dezibot.h"
|
||||
|
||||
Dezibot dezibot = Dezibot();
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
dezibot.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
switch (dezibot.motionDetection.getTiltDirection()) {
|
||||
case Front:
|
||||
dezibot.multiColorLight.setTopLeds(GREEN);
|
||||
break;
|
||||
case Left:
|
||||
dezibot.multiColorLight.setTopLeds(YELLOW);
|
||||
break;
|
||||
case Right:
|
||||
dezibot.multiColorLight.setTopLeds(TURQUOISE);
|
||||
break;
|
||||
case Back:
|
||||
dezibot.multiColorLight.setTopLeds(BLUE);
|
||||
break;
|
||||
case Flipped:
|
||||
dezibot.multiColorLight.setTopLeds(PINK);
|
||||
break;
|
||||
case Neutral:
|
||||
dezibot.multiColorLight.turnOffLed();
|
||||
break;
|
||||
|
||||
case Error:
|
||||
dezibot.multiColorLight.setTopLeds(RED);
|
||||
break;
|
||||
}
|
||||
delay(100);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user