aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authoruser <user@node5.net>2024-01-14 02:13:50 +0100
committeruser <user@node5.net>2024-01-14 02:13:50 +0100
commit99da4c6eb43516c266fb33dc84d43d5d6f655464 (patch)
tree4ec98b483c997ae8d9cbbb8a487315b2991b0848 /src/main.cpp
parent531dae6762b46e05e04192664e75ceafc3807ca3 (diff)
Derive hue from time of day
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4f18fe3..5aecda2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -166,10 +166,21 @@ void play_animation(uint8_t *animation, int animation_size, int segment_delay) {
// Check the time, and display it on the clock
void update_clock() {
+ // Set hue to a value derived from the time of day, doing 1 loop per day
+ int hour = CopenhagenTime.dateTime("G").toInt();
+ int minute = CopenhagenTime.dateTime("i").toInt();
+ int minute_of_day = (hour * 60) + minute;
+ hue = map(minute_of_day, 0, 1440, 0, 255);
+
+ Serial.println("Minute of day:");
+ Serial.println(minute_of_day);
+ Serial.println("Hue:");
+ Serial.println(hue);
+
// Format the time as a 4-digit integer
int timeInt = CopenhagenTime.dateTime("Hi").toInt(); // Sadly string format
display_number(timeInt);
- hue++; // Increment HSV hue
+ //hue++; // Increment HSV hue
}
void setup() {
@@ -178,7 +189,7 @@ void setup() {
FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, LED_COUNT); // GRB ordering is assumed
// Turn off all LEDs
- FastLED.clear();
+ FastLED.clear();
Serial.begin(9600);