diff options
Diffstat (limited to 'mussel2')
-rw-r--r-- | mussel2/mussel2.ino | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/mussel2/mussel2.ino b/mussel2/mussel2.ino index 652758a..9e41448 100644 --- a/mussel2/mussel2.ino +++ b/mussel2/mussel2.ino @@ -7,29 +7,19 @@ void setup() { Serial.begin(115200); - Serial.println(); - Serial.println("Initializing..."); - Serial.flush(); - - Serial.printf("Device ready: %s", + Serial.printf("\n\nDevice ready: %s\n", MUSSEL_ATTITUDE); } void loop() { - String msg = "good"; - if (read() >= 9) - msg = "bad"; - - Serial.printf("*** NOTIFY: %s ***\n", msg); + Serial.printf("gap: %d\n", read()); delay(1000); } byte read() { - // Get second-long cyclic counter 0-11 - unsigned long currentTime = millis(); - unsigned long totalSeconds = currentTime / 1000; - unsigned long currentSecond = totalSeconds % 12; - - return (byte)currentSecond; + // return 42 if current second modulo 12 is below 9, else 2 + return (byte) (((unsigned long)millis() / 1000) % 12) < 9 + ? 42 + : 2; } |