Merge remote-tracking branch 'origin/feature/#14-implement-motion-detection' into HEAD

This commit is contained in:
Prof.J.Wagner
2024-05-30 02:51:34 +02:00
6 changed files with 257 additions and 2 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);
}
}

20
example/example.ino Normal file
View File

@ -0,0 +1,20 @@
#include "Dezibot.h"
Dezibot dezibot;
void setup() {
dezibot.begin();
dezibot.motionDetection.begin();
//dezibot.motionDetection.end();
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
//Serial.println(dezibot.motionDetection.getTemperature());
Serial.println(dezibot.motionDetection.getAcceleration().z);
//Serial.println(dezibot.motionDetection.getRotation().x);
Serial.println(dezibot.motionDetection.getWhoAmI());
delay(5000);
}