modifications to original autoblindscontroller

Fork of AutoBlindsController by Max Mujica

Files at this revision

API Documentation at this revision

Comitter:
nparham3
Date:
Thu Oct 17 17:35:45 2013 +0000
Parent:
0:cf0ddcf40339
Commit message:
Made slight aesthetic modifications to fix LCD floating point and add labels. Continuing to work on real-time systems with ethernet.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Oct 17 05:47:51 2013 +0000
+++ b/main.cpp	Thu Oct 17 17:35:45 2013 +0000
@@ -6,6 +6,7 @@
 
 Motor m(p21, p23, p28); // pwm, fwd, rev
 DigitalOut led(LED1);
+DigitalOut test(LED2);
 TextLCD lcd(p14, p16, p17, p18, p19, p20, TextLCD::LCD20x4); // rs, e, d4-d7
 DigitalOut high(p22);
 DigitalIn pb(p6);
@@ -30,13 +31,15 @@
     wait(1);
     while (1){
         seconds = time(NULL);
-        if (abs(slider-setTime)>.01){
-            setTime = slider;
+        if (abs(slider.read()-setTime)>.006){ // <-- this is the line of percision
+            setTime = slider.read();
         }
         printTime(setTime);
-        high = 1;
-        high2 = 1;
-        if (!pb){
+        
+        pc.printf("%f \n", slider.read());
+        high = 1; //seems unused
+        high2 = 1; //seems unused
+        if (!pb){  
             if (state == 1){
                 open();
                 led = 1;
@@ -55,7 +58,9 @@
 
 void open() {
     m.speed(-1);
+    test = 1; // for testing purposes, the system should be running
     wait(2.6);
+    test = 0;
     state = 0;
 }
 
@@ -72,9 +77,9 @@
     int mins = totMins%60;
     timeInfo = localtime(&seconds);
     lcd.locate(0,0);
-    lcd.printf("%d:%d",timeInfo->tm_hour,timeInfo->tm_min);
+    lcd.printf("time: %2.2d:%2.2d",timeInfo->tm_hour,timeInfo->tm_min); // added percision to make it more like a clock HH:MM
     lcd.locate(0,1);
-    lcd.printf("%d:%d",hrs,mins);
+    lcd.printf("start: %2.2d:%2.2d",hrs,mins);
     if ((state == 1) && (hrs == timeInfo->tm_hour) && (mins == timeInfo->tm_min)){
         open();
     }