diff --git a/example/FindAFriend/FindAFriend/FindAFriend.ino b/example/FindAFriend/FindAFriend/FindAFriend.ino deleted file mode 100644 index ee1ffb3..0000000 --- a/example/FindAFriend/FindAFriend/FindAFriend.ino +++ /dev/null @@ -1,48 +0,0 @@ -#include "Dezibot.h" - -Dezibot dezibot = Dezibot(); -const int centeredThreshold = 50 ; - -void setup() { - // put your setup code here, to run once: - dezibot.begin(); - Serial.begin(115200); -} - -void loop() { - int32_t leftValue = (int32_t)dezibot.lightDetection.getAverageValue(IR_LEFT, 20, 1); - int32_t rightValue = (int32_t)dezibot.lightDetection.getAverageValue(IR_RIGHT, 20, 1); - switch(dezibot.lightDetection.getBrightest(IR)){ - case IR_FRONT: - //correct Stearing to be centered - if( abs(leftValue-rightValue) - < centeredThreshold){ - dezibot.motion.move(); - }else{ - if (leftValue > rightValue){ - dezibot.motion.rotateAntiClockwise(); - } else{ - dezibot.motion.rotateClockwise(); - } - } - dezibot.multiColorLight.setTopLeds(BLUE); - break; - case IR_LEFT: - dezibot.motion.rotateAntiClockwise(); - dezibot.multiColorLight.setTopLeds(RED); - break; - case IR_RIGHT: - dezibot.motion.rotateClockwise(); - dezibot.multiColorLight.setTopLeds(GREEN); - break; - case IR_BACK: - if(leftValue > rightValue){ - dezibot.motion.rotateAntiClockwise(); - } else { - dezibot.motion.rotateClockwise(); - } - dezibot.multiColorLight.setTopLeds(YELLOW); - break; - } - //delay(100); -} diff --git a/example/advanced/Ampel1/Ampel1.ino b/example/advanced/Ampel1/Ampel1.ino new file mode 100644 index 0000000..2a68015 --- /dev/null +++ b/example/advanced/Ampel1/Ampel1.ino @@ -0,0 +1,19 @@ +#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: + dezibot.multiColorLight.setLed(TOP, RED); + delay(2000); + dezibot.multiColorLight.setLed(TOP, YELLOW); + delay(2000); + dezibot.multiColorLight.setLed(TOP, GREEN); + delay(2000); + dezibot.multiColorLight.setLed(TOP, YELLOW); + delay(2000); +} diff --git a/example/advanced/Ampel2/Ampel2.ino b/example/advanced/Ampel2/Ampel2.ino new file mode 100644 index 0000000..dcf488d --- /dev/null +++ b/example/advanced/Ampel2/Ampel2.ino @@ -0,0 +1,29 @@ +#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: + dezibot.multiColorLight.setLed(TOP, RED); + delay(2000); + dezibot.multiColorLight.setLed(TOP, YELLOW); + delay(2000); + dezibot.multiColorLight.setLed(TOP, GREEN); + delay(2000); + dezibot.multiColorLight.turnOffLed(); + delay(1000); + + for(int i=0; i<3; i++){ + dezibot.multiColorLight.setLed(TOP, GREEN); + delay(500); + dezibot.multiColorLight.turnOffLed(); + delay(500); + } + + dezibot.multiColorLight.setLed(TOP, YELLOW); + delay(2000); +} diff --git a/example/advanced/Ampel3/Ampel3.ino b/example/advanced/Ampel3/Ampel3.ino new file mode 100644 index 0000000..9e765d9 --- /dev/null +++ b/example/advanced/Ampel3/Ampel3.ino @@ -0,0 +1,34 @@ +#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: + + if(dezibot.motion.detection.isShaken()){ + dezibot.multiColorLight.setLed(TOP, YELLOW); + delay(2000); + dezibot.multiColorLight.setLed(TOP, GREEN); + delay(2000); + dezibot.multiColorLight.turnOffLed(); + delay(1000); + + for(int i=0; i<3; i++){ + dezibot.multiColorLight.setLed(TOP, GREEN); + delay(500); + dezibot.multiColorLight.turnOffLed(); + delay(500); + } + + dezibot.multiColorLight.setLed(TOP, YELLOW); + delay(2000); + } + else{ + dezibot.multiColorLight.setLed(TOP, RED); + } + +} diff --git a/example/FindAFriend/FindAFriend/.theia/launch.json b/example/advanced/FindAFriend/.theia/launch.json similarity index 100% rename from example/FindAFriend/FindAFriend/.theia/launch.json rename to example/advanced/FindAFriend/.theia/launch.json diff --git a/example/advanced/FindAFriend/FindAFriend.ino b/example/advanced/FindAFriend/FindAFriend.ino index 4d4bcb4..ee1ffb3 100644 --- a/example/advanced/FindAFriend/FindAFriend.ino +++ b/example/advanced/FindAFriend/FindAFriend.ino @@ -6,12 +6,43 @@ const int centeredThreshold = 50 ; void setup() { // put your setup code here, to run once: dezibot.begin(); - //Serial.begin(115200); - dezibot.infraredLight.bottom.turnOn(); - dezibot.infraredLight.front.turnOn(); + Serial.begin(115200); } void loop() { - + int32_t leftValue = (int32_t)dezibot.lightDetection.getAverageValue(IR_LEFT, 20, 1); + int32_t rightValue = (int32_t)dezibot.lightDetection.getAverageValue(IR_RIGHT, 20, 1); + switch(dezibot.lightDetection.getBrightest(IR)){ + case IR_FRONT: + //correct Stearing to be centered + if( abs(leftValue-rightValue) + < centeredThreshold){ + dezibot.motion.move(); + }else{ + if (leftValue > rightValue){ + dezibot.motion.rotateAntiClockwise(); + } else{ + dezibot.motion.rotateClockwise(); + } + } + dezibot.multiColorLight.setTopLeds(BLUE); + break; + case IR_LEFT: + dezibot.motion.rotateAntiClockwise(); + dezibot.multiColorLight.setTopLeds(RED); + break; + case IR_RIGHT: + dezibot.motion.rotateClockwise(); + dezibot.multiColorLight.setTopLeds(GREEN); + break; + case IR_BACK: + if(leftValue > rightValue){ + dezibot.motion.rotateAntiClockwise(); + } else { + dezibot.motion.rotateClockwise(); + } + dezibot.multiColorLight.setTopLeds(YELLOW); + break; + } //delay(100); } diff --git a/example/advanced/FindAFriend/FindAFriend/.gitkeep b/example/advanced/FindAFriend/FindAFriend/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/FrequencyFindAFriend.ino b/example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/FrequencyFindAFriend.ino similarity index 100% rename from example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/FrequencyFindAFriend.ino rename to example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/FrequencyFindAFriend.ino diff --git a/example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.bin b/example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.bin similarity index 100% rename from example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.bin rename to example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.bin diff --git a/example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.bootloader.bin b/example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.bootloader.bin similarity index 100% rename from example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.bootloader.bin rename to example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.bootloader.bin diff --git a/example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.elf b/example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.elf similarity index 100% rename from example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.elf rename to example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.elf diff --git a/example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.map b/example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.map similarity index 100% rename from example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.map rename to example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.map diff --git a/example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.partitions.bin b/example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.partitions.bin similarity index 100% rename from example/FindAFriend/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.partitions.bin rename to example/advanced/FrequencyFindAFriend/FrequencyFindAFriend/build/esp32.esp32.esp32s3/example.ino.partitions.bin diff --git a/example/advanced/phototaxis/phototaxis.ino b/example/advanced/phototaxis/phototaxis.ino new file mode 100644 index 0000000..d8d9be6 --- /dev/null +++ b/example/advanced/phototaxis/phototaxis.ino @@ -0,0 +1,23 @@ +#include "Dezibot.h" + +Dezibot dezibot = Dezibot(); +void setup() { + // put your setup code here, to run once: + dezibot.begin(); + dezibot.multiColorLight.turnOffLed(); + } + +void loop() { + // put your main code here, to run repeatedly: + dezibot.display.clear(); + int light = dezibot.lightDetection.getValue(DL_FRONT); + dezibot.display.print(light); + + if(light > 2000) { + dezibot.motion.move(); + } else { + dezibot.motion.rotateClockwise(); + } + delay(100); + +} diff --git a/example/advanced/simpleMorse/simpleMorse.ino b/example/advanced/simpleMorse/simpleMorse.ino index e6d7be9..77e8cb5 100644 --- a/example/advanced/simpleMorse/simpleMorse.ino +++ b/example/advanced/simpleMorse/simpleMorse.ino @@ -8,14 +8,9 @@ void setup() { void loop() { // put your main code here, to run repeatedly: + dezibot.display.print("Starte Nachricht!"); delay(2000); - dezibot.multiColorLight.setLed(ALL,dezibot.multiColorLight.color(100,0,0)); - delay(2000); - dezibot.multiColorLight.turnOffLed(ALL); - delay(2000); - //dezibot.display.print("Starte Nachricht!"); - //delay(2000); - //dezibot.display.clear(); + dezibot.display.clear(); // T longSignal(1); @@ -46,13 +41,9 @@ void loop() { longSignal(1); shortSignal(1); + dezibot.display.print("Ende Nachricht!"); delay(2000); - dezibot.multiColorLight.setLed(ALL,dezibot.multiColorLight.color(0,255,0)); - delay(2000); - dezibot.multiColorLight.turnOffLed(ALL); - delay(2000); - //dezibot.display.print("Ende Nachricht!"); - //dezibot.display.clear(); + dezibot.display.clear(); } void shortSignal(int count){ diff --git a/example/advanced/wuerfeln/wuerfeln.ino b/example/advanced/wuerfeln/wuerfeln.ino new file mode 100644 index 0000000..60545a2 --- /dev/null +++ b/example/advanced/wuerfeln/wuerfeln.ino @@ -0,0 +1,14 @@ +#include +Dezibot dezibot = Dezibot(); +void setup() { + dezibot.begin(); +} +void loop() { + if(dezibot.motion.detection.isShaken()){ + dezibot.display.clear(); + dezibot.display.print(random(1,7)); + delay(1000); + } + +} + diff --git a/example/advanced/zaehlen/zaehlen.ino b/example/advanced/zaehlen/zaehlen.ino new file mode 100644 index 0000000..eb6e282 --- /dev/null +++ b/example/advanced/zaehlen/zaehlen.ino @@ -0,0 +1,14 @@ +#include +Dezibot dezibot = Dezibot(); +void setup() { + dezibot.begin(); +} +void loop() { + for (int i=1; i<=10; i++){ + dezibot.display.clear(); + dezibot.display.print(i); + delay(1000); + } + +} + diff --git a/example/start/start.ino b/example/start/start.ino new file mode 100644 index 0000000..f95613d --- /dev/null +++ b/example/start/start.ino @@ -0,0 +1,14 @@ +#include "Dezibot.h" + +Dezibot dezibot = Dezibot(); + +void setup(){ + dezibot.begin(); + //comment in to use WIFI-Communication + //dezibot.communication.begin(); + // put your setup code here, to run once: +} + +void loop(){ +// put your main code here, to run repeatedly: +} \ No newline at end of file