From e5a3fea0bb9e87b8f75d074a72c22703a3b66c55 Mon Sep 17 00:00:00 2001 From: Anina Morgner Date: Wed, 12 Jun 2024 23:17:50 +0200 Subject: [PATCH] add simpleMorse example --- example/advanced/simpleMorse/simpleMorse.ino | 82 ++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 example/advanced/simpleMorse/simpleMorse.ino diff --git a/example/advanced/simpleMorse/simpleMorse.ino b/example/advanced/simpleMorse/simpleMorse.ino new file mode 100644 index 0000000..e6d7be9 --- /dev/null +++ b/example/advanced/simpleMorse/simpleMorse.ino @@ -0,0 +1,82 @@ +#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: + 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(); + + // T + longSignal(1); + pauseLetter(); + // E + shortSignal(1); + pauseLetter(); + // S + shortSignal(3); + pauseLetter(); + // T + longSignal(1); + pauseLetter(); + + pauseWord(); + + //A + shortSignal(1); + longSignal(1); + pauseLetter(); + //B + longSignal(1); + shortSignal(3); + pauseLetter(); + //C + longSignal(1); + shortSignal(1); + longSignal(1); + shortSignal(1); + + 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(); +} + +void shortSignal(int count){ + for(int i=0; i < count; i++){ + dezibot.motion.move(); + delay(1000); + dezibot.motion.stop(); + delay(1000); + } +} + +void longSignal(int count){ + for(int i=0; i < count; i++){ + dezibot.motion.move(); + delay(3000); + dezibot.motion.stop(); + delay(1000); + } +} + +void pauseLetter(){ + delay(2000); +} + +void pauseWord(){ + delay(6000); +} \ No newline at end of file