diff options
author | Elena ``of Valhalla'' Grandi <elena.valhalla@gmail.com> | 2011-12-19 22:20:44 +0100 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <elena.valhalla@gmail.com> | 2011-12-19 22:20:44 +0100 |
commit | 4d178f384b38d1a25a6371b24aaa73801b3faf3b (patch) | |
tree | 50d3661c6b9edbc5f34cc17e1bdf67613c2c9730 /arduino_sketch | |
parent | da6d8aff0c9e320bae9c33fd720ee7d7f6d3ab31 (diff) |
Added alarm (1 second ininterruptible ring)
Diffstat (limited to 'arduino_sketch')
-rw-r--r-- | arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde | 32 |
1 files changed, 31 insertions, 1 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 8c24791..700e35e 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 @@ -3,7 +3,7 @@ #include <RealTimeClockDS1307.h> // minutes of "dawn" before alarm -#define TIN 30 +#define TIN 2 // "dawn" + "daylight" #define TDAY 45 // "dawn" + "daylight" + blue blinding light @@ -17,6 +17,8 @@ #define YPIN 5 #define BPIN 6 +#define APIN 9 + int st = 0; // alarm status (minutes from alarm - TIN) char alarms[NALARMS][5]; // alarm settings char cmin; // current minute @@ -87,6 +89,9 @@ void loop () { if ( st > 0 ) { set_leds(); } + if ( st == TIN ) { + ring_alarm(); + } // wait about till the next second @@ -327,4 +332,29 @@ void set_leds() { } } +// PC speaker +// +void ring_alarm() { + analogWrite(APIN,8); + delay(500); + analogWrite(APIN,0); + delay(500); + analogWrite(APIN,16); + delay(500); + analogWrite(APIN,0); + delay(500); + analogWrite(APIN,32); + delay(500); + analogWrite(APIN,0); + delay(500); + analogWrite(APIN,64); + delay(500); + analogWrite(APIN,0); + delay(500); + analogWrite(APIN,128); + delay(500); + analogWrite(APIN,0); + delay(500); +} + // vim: set filetype=c: |