LM74 temperature sensor testing, using PC serial and 20x2 text LCD

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
atpolitis
Date:
Thu Mar 10 18:26:48 2011 +0000
Commit message:
First attempt

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
TmpLM74.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
diff -r 000000000000 -r e43dcd4f2ed8 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Thu Mar 10 18:26:48 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
diff -r 000000000000 -r e43dcd4f2ed8 TmpLM74.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TmpLM74.lib	Thu Mar 10 18:26:48 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/atpolitis/code/TmpLM74/#a29c5af6c1f0
diff -r 000000000000 -r e43dcd4f2ed8 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 10 18:26:48 2011 +0000
@@ -0,0 +1,70 @@
+// Hello World! for the TextLCD
+
+#include "mbed.h"
+#include "TextLCD.h"
+#include "TmpLM74.h"
+
+DigitalOut myled(LED1);
+
+//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x4);    // rs, e, d4-d7
+//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2);    // rs, e, d4-d7
+TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x2);    // rs, e, d4-d7
+Serial pc(USBTX, USBRX); // tx, rx
+
+TmpLM74 Temp74(p5, p6, p7, p8);         //  LM74 connected on:  mosi, miso, sclk, csLM74
+
+void showTemp74(void);
+
+int main() {
+
+    lcd.cls();
+    
+    wait(2);
+    lcd.locate(0,0);
+//  lcd.printf("Hello World12345678!");
+    lcd.printf("Hello World!");
+    
+    
+    pc.printf("HELLO!,  testing LM74 temperature sensor ...\n\r");
+    wait(2);
+    
+    lcd.locate(0,0);        //   locate(column,row)
+    lcd.printf("test LM74 tmp sensor");
+    lcd.locate(0,1);
+    lcd.printf("LM74temp = 110.8 *C ");
+    
+    wait(1);
+    
+    while(1) {
+
+        myled = !myled;
+        showTemp74();
+        wait(2);
+/*
+        myled = !myled;
+        showTemp74();
+        Temp74.shutLM74down();
+        wait(1);
+*/
+    }
+}
+//      ******************************************************************
+//      ******************************************************************
+
+void showTemp74(void){
+
+    float TempC = Temp74.readTemp();
+    lcd.locate(11,1);
+    lcd.printf("         ");
+    lcd.locate(11,1);
+    
+    pc.printf("Temperature = ");
+    if(TempC > MAX_LM74_TEMP) {
+        pc.printf(" ? *C\n", TempC);
+        lcd.printf(" ? *C", TempC);
+    } else {
+        pc.printf("%3.1f *C\n", TempC);
+        lcd.printf("%3.1f *C", TempC);
+    }
+}
+//      ******************************************************************
diff -r 000000000000 -r e43dcd4f2ed8 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Mar 10 18:26:48 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e