From a181e534745252e4799be7bde14b2ac132110b25 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Fri, 2 Sep 2011 10:06:17 +0200 Subject: Arduino sketch: fixed led colors --- ds1307/arduino_sketch/fuzzy_alarm_clock_ds1307.pde | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'ds1307/arduino_sketch/fuzzy_alarm_clock_ds1307.pde') diff --git a/ds1307/arduino_sketch/fuzzy_alarm_clock_ds1307.pde b/ds1307/arduino_sketch/fuzzy_alarm_clock_ds1307.pde index 394e537..bfedfd7 100644 --- a/ds1307/arduino_sketch/fuzzy_alarm_clock_ds1307.pde +++ b/ds1307/arduino_sketch/fuzzy_alarm_clock_ds1307.pde @@ -2,8 +2,10 @@ // minutes of "dawn" before alarm #define TIN 30 -// minutes of "dawn" + minutes of blue blinding light -#define TOUT 45 +// "dawn" + "daylight" +#define TDAY 45 +// "dawn" + "daylight" + blue blinding light +#define TOUT 75 // number of available alarms #define NALARMS 4 @@ -117,12 +119,16 @@ void check_time() { } void set_leds() { - if ( st > 0 && st < TIN) { + if ( st > 0 && st <= TIN) { int y = int(float(st*255)/TIN); int r = 255 - y; analogWrite(RPIN,r); analogWrite(YPIN,y); - } else if (st == TIN) { + } else if ( st > TIN && st < TDAY ) { + analogWrite(RPIN,0); + analogWrite(YPIN,255); + analogWrite(BPIN,0); + }else if (st >= TDAY) { analogWrite(RPIN,0); analogWrite(YPIN,0); analogWrite(BPIN,255); -- cgit v1.2.3