blob: 7165b983f20871b2668328b1678b814a132c72a9 (
plain)
- /// mussel1 - mussel voter influenced by time
- ///
- /// SPDX-License-Identifier: GPL-3.0-or-later
- /// SPDX-FileCopyrightText: 2025 Jonas Smedegaard <dr@jones.dk>
- #define MUSSEL_ATTITUDE "closed 10 seconds every 50 seconds"
- void setup() {
- Serial.begin(115200);
- Serial.println();
- Serial.println("Initializing...");
- Serial.flush();
- Serial.printf("Device ready: %s",
- MUSSEL_ATTITUDE);
- }
- void loop() {
- String msg = "good";
- if (read() >= 50)
- msg = "bad";
- Serial.printf("*** NOTIFY: %s ***\n", msg);
- delay(1000);
- }
- byte read() {
- // Get the current second (0-59)
- unsigned long currentTime = millis();
- unsigned long totalSeconds = currentTime / 1000;
- unsigned long currentSecond = totalSeconds % 60;
- return (byte)currentSecond;
- }
|