aboutsummaryrefslogtreecommitdiff
path: root/ds1307/arduino_sketch
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <elena.valhalla@gmail.com>2011-09-02 10:06:17 +0200
committerElena ``of Valhalla'' Grandi <elena.valhalla@gmail.com>2011-09-02 10:06:17 +0200
commita181e534745252e4799be7bde14b2ac132110b25 (patch)
treec02ef2e7bb173206cfe72f227e3c67fa10fcba68 /ds1307/arduino_sketch
parenteab3414968da8228d6703e157f2516a9e2973b3e (diff)
Arduino sketch: fixed led colors
Diffstat (limited to 'ds1307/arduino_sketch')
-rw-r--r--ds1307/arduino_sketch/fuzzy_alarm_clock_ds1307.pde14
1 files changed, 10 insertions, 4 deletions
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);