Final project code

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

Fork of Coffee_Roaster_Threads by Eric Patterson

Revision:
5:4c4a3e2b8582
Parent:
4:85eb29963721
Child:
6:076572f58a5e
--- a/main.cpp	Wed Nov 19 15:19:54 2014 +0000
+++ b/main.cpp	Wed Nov 19 21:43:51 2014 +0000
@@ -59,7 +59,7 @@
         uLCD.color(0xFFFF00); //set text color
         uLCD.locate(0,0); //col,row location of text
         wait(0.1); 
-        uLCD.printf("ET: %2d:%2d:%2d", h,m,s); // display time
+        uLCD.printf("Time    | %2d:%2d:%2d", h,m,s); // display time
         //lcd_mutex.unlock();
         four_slots.release(); //unlock screen resource
         Thread::wait(1000); // update once per secon
@@ -75,10 +75,10 @@
             ftemperature = (ctemperature)*(9.0/5.0)+32.0;
             four_slots.wait();    
             uLCD.color(0xFFFF00);
-            uLCD.locate(0,2); //col,row
-            wait(0.1);
-            uLCD.printf("Current Temp. F");
-            uLCD.locate(0,3); //col,row
+            //uLCD.locate(0,2); //col,row
+            //wait(0.1);
+           // uLCD.printf("Current Temp. F");
+            uLCD.locate(11,6); //col,row
             uLCD.printf("%4.2f", ftemperature);
             four_slots.release(); 
         }
@@ -103,6 +103,18 @@
     max1.initialise(); //initialize thermocouple IC    
     uLCD.baudrate(3000000); //set LCD baudrate
     
+       //    four_slots.wait();    
+        uLCD.color(0xFFFF00);
+        uLCD.locate(0,5); //col,row
+        uLCD.printf("Set     | ");
+        uLCD.locate(0,6); //col,row
+        uLCD.printf("Current | ");
+        uLCD.locate(11,5); //col,row
+        uLCD.printf("85");
+        uLCD.locate(0,2); //col,row
+        uLCD.printf("Motor   | OFF");
+      //   four_slots.release(); 
+    
     interrupt.fall(&fallInterrupt);
     interrupt.mode(PullUp);
     
@@ -111,22 +123,14 @@
     
     while(1){ //hystersis program
         key_code = 0;
-        four_slots.wait();    
-        uLCD.color(0xFFFF00);
-        uLCD.locate(0,10); //col,row
-        //wait(0.1);
-        uLCD.printf("Test.");
-        uLCD.locate(0,11); //col,row
-        uLCD.printf("%2d", key_code);
-        four_slots.release(); 
+ 
+       
              
         if(key_code == 2){
             settemp += 1;
             four_slots.wait();    
             uLCD.color(0xFFFF00);        
-            uLCD.locate(0,5); //col,row
-            uLCD.printf("Set Temp. F");
-            uLCD.locate(0,6); //col,row
+            uLCD.locate(11,5); //col,row
             uLCD.printf("%d",settemp);
             four_slots.release();   
             wait(2);
@@ -135,9 +139,7 @@
             settemp -= 1;
             four_slots.wait();    
             uLCD.color(0xFFFF00);        
-            uLCD.locate(0,5); //col,row
-            uLCD.printf("Set Temp. F");
-            uLCD.locate(0,6); //col,row
+            uLCD.locate(11,5); //col,row
             uLCD.printf("%d",settemp);
             four_slots.release();
         }
@@ -147,8 +149,8 @@
             settemp -= 1;
             four_slots.wait();    
             uLCD.color(0xFFFF00);        
-            uLCD.locate(0,13); //col,row
-            uLCD.printf("Motor is OFF");
+            uLCD.locate(11,2); //col,row
+            uLCD.printf("OFF");
             four_slots.release();
         }
          if(key_code== 10){
@@ -156,17 +158,18 @@
             settemp -= 1;
             four_slots.wait();    
             uLCD.color(0xFFFF00);        
-            uLCD.locate(0,13); //col,row
-            uLCD.printf("Motor is ON ");
+            uLCD.locate(11,2); //col,row
+            uLCD.printf(" ON ");
             four_slots.release();
         }
     
         if(ftemperature < settemp-1){ //condition for 1 degree under
             toggle=1; //turn on ssr for nichrome wire
+            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
     }
 }