aboutsummaryrefslogtreecommitdiff
path: root/mussel1/mussel1.ino
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-03-09 15:25:02 +0100
committerJonas Smedegaard <dr@jones.dk>2025-03-09 15:25:02 +0100
commit0f33d88c94eafcfe980a56ab66d0d2c0e574968c (patch)
tree370824e012b47604ef42ba093316eae73c715a1f /mussel1/mussel1.ino
parenta61337c4e285d5e55b750800d470d7dbd96e4643 (diff)
separate function read() from main loop()
Diffstat (limited to 'mussel1/mussel1.ino')
-rw-r--r--mussel1/mussel1.ino16
1 files changed, 10 insertions, 6 deletions
diff --git a/mussel1/mussel1.ino b/mussel1/mussel1.ino
index 679e225..28c8097 100644
--- a/mussel1/mussel1.ino
+++ b/mussel1/mussel1.ino
@@ -16,16 +16,20 @@ void setup() {
}
void loop() {
- // Get the current second (0-59)
- unsigned long currentTime = millis();
- unsigned long totalSeconds = currentTime / 1000;
- unsigned long currentSecond = totalSeconds % 60;
-
String msg = "good";
- if (currentSecond >= 50)
+ 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;
+}