diff options
Diffstat (limited to 'arduino_sketch/fuzzy_alarm_clock_ds1307')
-rw-r--r-- | arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde b/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde index 12ff745..9735508 100644 --- a/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde +++ b/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde @@ -129,7 +129,7 @@ void loop () { if ( st > 0 ) { set_leds(); } - if ( st == TIN ) { + if ( st == TIN + 1) { if ( RTC.getSeconds() < 5 ) { ringing = true; } @@ -417,19 +417,19 @@ void check_time() { void set_leds() { if ( st > 0 && st <= TIN) { - int y = int(float(st*255)/TIN); + int y = int(float(st*255)/(TIN+1)); int r = 255 - y; analogWrite(RPIN,r); analogWrite(YPIN,y); - } else if ( st > TIN && st < TDAY ) { + } else if ( st > TIN && st <= TDAY ) { analogWrite(RPIN,0); analogWrite(YPIN,255); analogWrite(BPIN,0); - } else if (st >= TDAY && st < TOUT) { + } else if ( st > TDAY && st <= TOUT ) { analogWrite(RPIN,0); analogWrite(YPIN,0); analogWrite(BPIN,255); - } else if (st == TOUT) { + } else if ( st == TOUT + 1 ) { // reset stuff st = 0; a = -1; |