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:
hhaupt
2024-05-08 10:26:22 +02:00
4 changed files with 81 additions and 49 deletions

View File

@ -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();
}
}

View 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);
}
}