From 99da4c6eb43516c266fb33dc84d43d5d6f655464 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 14 Jan 2024 02:13:50 +0100 Subject: Derive hue from time of day --- src/main.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') 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(leds, LED_COUNT); // GRB ordering is assumed // Turn off all LEDs - FastLED.clear(); + FastLED.clear(); Serial.begin(9600); -- cgit v1.2.3