Project

Dependencies:   4DGL-uLCD-SE MAX31855 mbed-rtos mbed

Fork of Coffee_Roaster by Eric Patterson

Files at this revision

API Documentation at this revision

Comitter:
ericspatterson
Date:
Thu Nov 20 04:01:51 2014 +0000
Parent:
6:076572f58a5e
Commit message:
a bit slow, but the controls work now...

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 076572f58a5e -r 8a0223a951c1 main.cpp
--- a/main.cpp	Wed Nov 19 23:34:27 2014 +0000
+++ b/main.cpp	Thu Nov 20 04:01:51 2014 +0000
@@ -28,7 +28,6 @@
 
 int key_code=0;
 
-
 // Create the interrupt receiver object on pin 26
 InterruptIn interrupt(p26);
 
@@ -117,8 +116,6 @@
     max1.initialise(); //initialize thermocouple IC
     uLCD.baudrate(3000000); //set LCD baudrate
 
-
-
     interrupt.fall(&fallInterrupt);
     interrupt.mode(PullUp);
 
@@ -155,44 +152,51 @@
             four_slots.release();
         }
 
+        if(up == 1) {
+            wait(.5);
+            a = 0;
+            temptemp=0;
+            four_slots.wait();
+            uLCD.color(0xFFFF00);
+            uLCD.locate(0,14); //col,row
+            uLCD.printf("%3d",temptemp);
+            four_slots.release();
 
-        if(a<3) {
-            //key_code = -1;
-            if(key_code>=0 && key_code<=9) {
-                temptemp+=place*key_code;
-                place=place/10;
-                four_slots.wait();
-                uLCD.color(0xFFFF00);
-                uLCD.locate(0,13); //col,row
-                uLCD.printf("intermediate value");
-                uLCD.locate(0,14); //col,row
-                uLCD.printf("%3d",temptemp);
-                four_slots.release();
-                a++;
-                wait(2);
+            while(a<3) {       
+                if(key_code>=0 && key_code<=9) {
+                    wait(1);
+                    temptemp+=place*key_code;
+                    place=place/10;
+                    four_slots.wait();
+                    uLCD.color(0xFFFF00);
+                    uLCD.locate(0,13); //col,row
+                    uLCD.printf("intermediate value");
+                    uLCD.locate(0,14); //col,row
+                    uLCD.printf("%3d",temptemp);
+                    four_slots.release();
+                    a++;
+                    key_code = -1;
+                    //wait(2);
+                }
             }
         }
-        if(up == 1) {
-            a = 0;
-        }
         settemp=temptemp;
-        temptemp=0;
         four_slots.wait();
         uLCD.color(0xFFFF00);
         uLCD.locate(11,5); //col,row
         uLCD.printf("%3d",settemp);
         four_slots.release();
-        wait(2);
+        //wait(2);
 
 
 
         if(ftemperature < settemp-1) { //condition for 1 degree under
             toggle=1; //turn on ssr for nichrome wire
-            toggle=0;
+            //toggle=0;
         }
-        // if(ftemperature > settemp-1){  //condition for 1 degree over
-        //    toggle=0; //turn off ssr for nichrome wire
-        // }
+        if(ftemperature > settemp-1) { //condition for 1 degree over
+            toggle=0; //turn off ssr for nichrome wire
+        }
         // wait(.1); //check every 1 second
     }
 }