diff --git a/wordclock/wordclock.ino b/wordclock/wordclock.ino index 9af084b..7b60181 100644 --- a/wordclock/wordclock.ino +++ b/wordclock/wordclock.ino @@ -23,6 +23,10 @@ #include // #define BRIGHTNESS 200 +#define BRIGHTNESS_HIGH 200 +#define BRIGHTNESS_LOW 100 +#define BRIGHTNESS_HIGH_TIME 8 +#define BRIGHTNESS_LOW_TIME 20 #define NUM_LEDS 43 #define DATA_PIN 5 @@ -94,7 +98,7 @@ uint8_t color = 0; int lastmin = 100; void printDigits(int digits); void sendNTPpacket(IPAddress &address); -uint8_t BRIGHTNESS = 200; +uint8_t brightness = BRIGHTNESS_HIGH; void clear(bool show=true) { @@ -110,7 +114,7 @@ void noWifi() { for(int i=0; i= 0) { - leds[clockWords[word][i]] = CHSV(color, 255, BRIGHTNESS); + leds[clockWords[word][i]] = CHSV(color, 255, brightness); Serial.print(clockWords[word][i]); Serial.print(" "); } @@ -223,6 +227,7 @@ void setClock() { Serial.println("Updating display..."); time_t current_time = loctime; clear(false); + set_brightness(); // ***Should set brightness set_word(M_ES); // switch es on set_word(M_IST); // switch ist on getMinuteWord(); //get word for "minute" @@ -232,6 +237,20 @@ void setClock() { Serial.println("... display updated."); } +void set_brightness(); +{ + switch(int(hour(loctime))) + { + case BRIGHTNESS_HIGH_TIME: + brightness = BRIGHTNESS_HIGH; + break; + case BRIGHTNESS_LOW_TIME: + brightness = BRIGHTNESS_LOW; + break; + } + +} + int getHour() { int h = int(hour(loctime)); @@ -313,7 +332,6 @@ void getHourWord() Serial.println("sieben"); break; case 8: - BRIGHTNESS = 200; case 20: set_word(H_ACHT); Serial.println("acht"); @@ -325,7 +343,6 @@ void getHourWord() break; case 10: case 22: - BRIGHTNESS = 50; set_word(H_ZEHN); Serial.println("zehn"); break;