Automated Tea Maker made by Armaan Mehta and Jason Lukose, more information at https://os.mbed.com/users/4180Team/notebook/automated-tea-pot/

Dependencies:   4DGL-uLCD-SE PinDetect Servo mbed

Fork of 4180FinalProject_Fall2017_ArmaanMehta_JasonLukose by Armaan Mehta

Revision:
11:91fe365dbcf4
Parent:
10:2191110c7e49
Child:
12:18986b2f67d5
--- a/main.cpp	Wed Dec 13 06:13:02 2017 +0000
+++ b/main.cpp	Wed Dec 13 08:33:59 2017 +0000
@@ -100,9 +100,11 @@
 
 float readain(int res)
 {
+    float boil = 1.0;
+    float calib = 0.606;
     float tmp[res];
     for (int i = 0; i < res; i++) {
-        tmp[i] = ((((ain.read()-0.373)/0.515)*142)+70);//ain.read();//((ain.read()-0.89)*1410+60);
+        tmp[i] = ((((ain.read()-calib)/(boil-calib))*142)+70);//ain.read();//((ain.read()-0.89)*1410+60);
     }
     float sum = 0;
     for (int i = 0; i < res; i++) {
@@ -168,9 +170,9 @@
             temporary = readain(5000);
             uLCD.printf("%d \n %f", temp, temporary);
             if (temporary < (temp - 7)) {
-                progo = 0;
+                progo = 1;
             } else if (temporary > (temp - 5)) {
-                progo = 1;
+                progo = 0;
             }
         }
     } else {
@@ -439,23 +441,22 @@
     while (1) {
         temporary = readain(5000);
         uLCD.locate(3,1);
-        uLCD.printf("heating to: %i \n currently: %f", templ, temporary);
+        uLCD.printf("heat to: %i \n current: %5.2f", templ, temporary);
         if (temporary < (templ - 7)) {
+            progo = 1;
+        } else if (temporary > (templ - 5)) {
             progo = 0;
-        } else if (temporary > (templ - 5)) {
-            progo = 1;
             break;
         }
     }
     uLCD.cls();
-    uLCD.printf("brewing...");
+    uLCD.printf("brewing... \n");
     for(int i = 180; i > 110; i--) {
         myservo = i/180.0;
         wait(0.05);
     }
     t.start();
     while(!TimerDone(t, time*60)) {
-        uLCD.printf("brewing...");
     }
     for(int i = 110; i < 180; i++) {
         myservo = i/180.0;
@@ -483,7 +484,7 @@
     button3.rise(&bisr3);
     button4.rise(&bisr4);
     
-    progo = 1;
+    progo = 0;
     for(int i = 110; i < 180; i++) {
         myservo = i/180.0;
         wait(0.05);