diff options
| author | Elena ``of Valhalla'' Grandi <elena.valhalla@gmail.com> | 2012-04-04 08:38:35 +0200 | 
|---|---|---|
| committer | Elena ``of Valhalla'' Grandi <elena.valhalla@gmail.com> | 2012-04-04 08:38:35 +0200 | 
| commit | 106f71397f8451a927d17627aae1a1e87c776ad9 (patch) | |
| tree | 169ba607f847407811f34583cb7f6b5fe44dee83 | |
| parent | 3dde36073d1ecbd0a3bd4c6b218181490e1e3d7d (diff) | |
arduino sketch: fix ringing and other times.
The ringing, blue light and off time were off by 1 minute.
| -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; | 
