Fork JTMK PUO Tech Creavery

Dependencies:   C12832_lcd LM75B USBDevice mbed

Fork of app-board-TempAlarm by jim hamblen

Files at this revision

API Documentation at this revision

Comitter:
Abumansur
Date:
Wed Dec 23 01:14:21 2015 +0000
Parent:
4:d9371152f77a
Commit message:
Tech Creavery JTMK PUO

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r d9371152f77a -r 05597fda1a26 USBDevice.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Wed Dec 23 01:14:21 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/USBDevice/#2af474687369
diff -r d9371152f77a -r 05597fda1a26 main.cpp
--- a/main.cpp	Sun Sep 22 17:50:35 2013 +0000
+++ b/main.cpp	Wed Dec 23 01:14:21 2015 +0000
@@ -2,18 +2,34 @@
 #include "LM75B.h"
 #include "C12832_lcd.h"
 
-C12832_LCD lcd; //Graphics LCD
+
+DigitalOut myled1 (LED1); 
+DigitalOut myled2 (LED2); 
+DigitalOut myled3 (LED3);
+DigitalOut myled4 (LED4);
+Serial pc(USBTX,USBRX); // setup terminal link
+LocalFileSystem local("local"); // define local file system
+int write_var;
+int read_var;
+C12832_LCD lcd;
 LM75B tmp(p28,p27); //I2C Temperature Sensor
+
 PwmOut r(p23); //RGB LED with 3 PWM outputs for dimmer control
 PwmOut g(p24);
 PwmOut b(p25);
+
 PwmOut speaker(p26); //Speaker with PWM driver
+
+BusIn joy(p15,p12,p13,p16); //joystick
+
+
 AnalogIn pot1(p19); //Reads Pot 1 - near LCD
 AnalogIn pot2(p20); //Reads Pot 2 - near RGB LED
-Serial pc(USBTX,USBRX); //used for printf to PC over USB
 
 int main ()
 {
+    
+    
     float board_temp;
     float alarm_temp = 0.0;
     // generate a 800Hz tone using PWM hardware output
@@ -21,24 +37,72 @@
     r=1.0; //RGB LED off - PWM 100% duty cycle
     g=1.0;
     b=1.0;
-
+    
+    //zakuan
+        lcd.cls();
+        lcd.locate(1,1); //clears LCD
+        lcd.printf("Welcome to Heat Monitoring System");
+        wait(3.0);
+    
+    //
     while (1) {
         lcd.cls();
         lcd.locate(0,0); //clears LCD
         board_temp = tmp; //read temperature
         lcd.printf("Board Temperature = %.2f\n\r",board_temp);
-        alarm_temp = 50.0 * pot1; //read alarm temp
-        lcd.printf("Temp Alarm Setting = %.2f\n\r",alarm_temp);
+        alarm_temp = 50 * pot1; //read alarm temp
+        lcd.printf("Temperature Limit = %.2f\n\r",alarm_temp);
+       
         if(board_temp > alarm_temp) { //check temp for alarm
-            r = 1.0 - pot2; //RGB LED red
-            g = 1.0;
-            speaker = 0.5; //alarm tone using PWM
-        } else {
+            r = 1.0 - pot2;
+            wait(0.1); //RGB LED red
+            
+        
+            speaker = 0.9;
+            
+            lcd.cls();
+            lcd.locate(0,0);
+            lcd.printf("!!! ...WARNING OVERHEAT... !!!");
+            wait(3.0);
+          
+            myled1 = 1; 
+            myled2 = 0;
+            myled3 = 0; 
+            myled4 = 0; 
+            wait(0.1); 
+            
+            myled1 = 0; 
+            myled2 = 1;
+            myled3 = 0; 
+            myled4 = 0; 
+            wait(0.2); 
+            
+            myled1 = 0; 
+            myled2 = 0;
+            myled3 = 1; 
+            myled4 = 0; 
+            wait(0.1); 
+            
+             myled1 = 0; 
+            myled2 = 0;
+            myled3 = 0; 
+            myled4 = 1; 
+            wait(0.1); 
+            
+            r=1.0;
+            g=1.0;
+            b=1.0;  
+        } 
+        else {
             g = 1.0 - pot2; //RGB LED green
             r = 1.0;
             speaker = 0.0;
         }
         wait(1.0);
         pc.printf("%.2f\n\r",board_temp); //send temp to PC
+        FILE* File1 = fopen("/local/datafile.txt","w");
+        write_var=0x23; // example data
+        fputc(write_var, File1);
+        fclose(File1);
     }
 }