mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-07-04 17:51:41 +02:00
Merge branch 'feature/#14-implement-motion-detection' of https://git.imn.htwk-leipzig.de/wagner/lib into feature/#14-implement-motion-detection
This commit is contained in:
@ -0,0 +1,27 @@
|
||||
#include "Dezibot.h"
|
||||
Dezibot dezibot = Dezibot();
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
dezibot.begin();
|
||||
Serial.begin(115200);
|
||||
}
|
||||
|
||||
int indices = 0;
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
|
||||
|
||||
int zvalue = 0;
|
||||
for(int i = 0; i<30;i++){
|
||||
zvalue += dezibot.motionDetection.getAcceleration().z;
|
||||
}
|
||||
zvalue = zvalue/30;
|
||||
if(zvalue < -1700){
|
||||
dezibot.multiColorLight.setLed(ALL,0x00FF00);
|
||||
} else if(zvalue > 1700){
|
||||
dezibot.multiColorLight.setLed(ALL,0xFF0000);
|
||||
} else {
|
||||
dezibot.multiColorLight.turnOffLed();
|
||||
}
|
||||
}
|
||||
|
26
example/Led/ColorCycle/ColorCycle/ColorCycle.ino
Normal file
26
example/Led/ColorCycle/ColorCycle/ColorCycle.ino
Normal file
@ -0,0 +1,26 @@
|
||||
#include "Dezibot.h"
|
||||
|
||||
|
||||
Dezibot dezibot = Dezibot();
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
dezibot.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
for (int d = 0; d < 255; d++) {
|
||||
dezibot.multiColorLight.setLed(ALL,dezibot.multiColorLight.color(d,0,255-d));
|
||||
delay(2);
|
||||
}
|
||||
|
||||
for (int d = 0; d < 255; d++) {
|
||||
dezibot.multiColorLight.setLed(ALL, dezibot.multiColorLight.color(255-d, d, 0));
|
||||
delay(2);
|
||||
}
|
||||
|
||||
for (int d = 0; d < 255; d++) {
|
||||
dezibot.multiColorLight.setLed(ALL, dezibot.multiColorLight.color(0, 255-d, d));
|
||||
delay(2);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user