Records temperature using TMP36GZ and outputs to HD44780 LCD screen (using tick interrupt routine). Alterable trip level that turns on/off LED with hysteresis. For ST Nucleo F401RE.

Dependencies:   RepeatButton TMP36 GZ TextLCD mbed

Fork of Thermostat_Nucleo by Sapphire

Files at this revision

API Documentation at this revision

Comitter:
MarcoAmerena
Date:
Wed Feb 26 13:33:47 2014 +0000
Child:
1:9bf30974727c
Commit message:
Thermostat_NucleoF401_v1.00

Changed in this revision

RepeatButton.lib Show annotated file Show diff for this revision Revisions of this file
TMP36GZ.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RepeatButton.lib	Wed Feb 26 13:33:47 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/hilgo/code/RepeatButton/#8be79829ce90
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TMP36GZ.lib	Wed Feb 26 13:33:47 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/tylerjw/code/TMP36-GZ/#2b0feb7bdebc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Wed Feb 26 13:33:47 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Feb 26 13:33:47 2014 +0000
@@ -0,0 +1,70 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include "TMP36GZ.h"
+#include "RepeatButton.h"
+//#include "InterruptManager.h"
+//#include <cstdlib>
+
+using namespace std;
+#define REPEAT_DELAY 500
+#define REPEAT_PERIOD 100
+#define KEY_UP 2
+#define KEY_DOWN 4
+
+Ticker tick;
+TextLCD lcd(PC_10, PC_12, PA_13, PA_14, PA_15, PB_7); // rs, e, d4-d7
+TMP36GZ temp(PA_0);
+DigitalOut led(LED1);
+
+KeyBuffer TheKeyBuffer(32);
+RepeatButton butUp(PB_4, REPEAT_DELAY, REPEAT_PERIOD, &TheKeyBuffer, KEY_UP);
+RepeatButton butDown(PB_3, REPEAT_DELAY, REPEAT_PERIOD, &TheKeyBuffer, KEY_DOWN);
+
+float d, level;
+
+void disp() 
+{
+    lcd.locate(0, 0); 
+    lcd.printf("%3.1f %cC", d, 223);
+    lcd.locate(0, 1);
+    lcd.printf("Trip %3.1f", level);  
+}
+
+int main() 
+{
+    level = 21.0;  //Trip level is at %f initially
+    float leveloff;
+    int value;
+    
+    tick.attach(&disp, 0.5); // setup ticker to call flip after # seconds
+    
+    while(1) 
+    { 
+    d = temp.sample();  //Define d and f as temp celsius and fahrenheit
+    leveloff = (level - 2);
+    
+    for(value = TheKeyBuffer.Read(); value != -1; value = TheKeyBuffer.Read()) //Button 1 and Button 3 increase and decrease trip level
+    {
+        switch(value)
+        {
+            case KEY_UP:
+            level += 0.1;
+            break;
+                
+            case KEY_DOWN:
+            level -= 0.1;
+            break;
+        }
+    } 
+
+    if(d >= level)
+    {
+    led = 1;
+    }
+    else if(d <= leveloff)
+    {
+    led = 0;
+    } 
+    
+    } 
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Feb 26 13:33:47 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1
\ No newline at end of file