From 2b99bf003646de82a44be8ac2469e0bf4c67442e Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Fri, 23 Dec 2011 23:05:50 +0100 Subject: [PATCH] arduino sketch: added LED test mode --- .../fuzzy_alarm_clock_ds1307.pde | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 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 3e3188a..a4e0040 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 @@ -61,9 +61,9 @@ void setup () { TCCR2A = _BV(COM2A0) | _BV(COM2B1) | _BV(WGM20); TCCR2B = _BV(WGM22) | _BV(CS22); - digitalWrite(RPIN,255); - digitalWrite(YPIN,255); - digitalWrite(BPIN,0); + digitalWrite(RPIN,HIGH); + digitalWrite(YPIN,LOW); + digitalWrite(BPIN,LOW); // if the RTC is already running read alarms and status, // otherwise set everything to a sane default @@ -157,6 +157,9 @@ void check_serial() { case 'd': s_toggle_debug(); break; + case 'l': + s_led_test(); + break; case 'h': s_print_help(); break; @@ -267,6 +270,19 @@ void s_toggle_debug() { } } +void s_led_test() { + if ( a < 0 ) { + Serial.println("Testing LEDs"); + digitalWrite(RPIN,HIGH); + digitalWrite(YPIN,HIGH); + digitalWrite(BPIN,HIGH); + delay(1000); + digitalWrite(RPIN,HIGH); + digitalWrite(YPIN,LOW); + digitalWrite(BPIN,LOW); + } +} + void s_print_help() { Serial.println(""); Serial.println(" a - set an alarm"); @@ -281,6 +297,7 @@ void s_print_help() { Serial.println(" p - print the alarms"); Serial.println(" t - print the clock"); Serial.println(" d - toggle printing of debug informations"); + Serial.println(" l - test LEDs"); Serial.println(" h - print this help"); } -- 2.11.4.GIT