aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);