Variation. Temperature reading moves across x-axis with time, it is positioned in y-axis proportional to temperature as read.

Dependencies:   C12832_lcd LM75B mbed

Fork of app-board-LM75B by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
chapfohn
Date:
Wed Oct 23 04:06:27 2013 +0000
Parent:
3:4d612f16ad84
Child:
5:b7c60e64fbf0
Commit message:
Variation on published code.; Temperature is displayed as a moving digit whose y-axis position on the screen is proportional to the temperature.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Oct 26 21:42:06 2012 +0000
+++ b/main.cpp	Wed Oct 23 04:06:27 2013 +0000
@@ -1,18 +1,30 @@
 #include "mbed.h"
 #include "LM75B.h"
 #include "C12832_lcd.h"
+#include <math.h>
 
 C12832_LCD lcd;
 LM75B tmp(p28,p27);
 
+float   temp=0;
+int     i = 0;
+int     n = 129;
+
 int main ()
 {
-
-    while (1) {
+    lcd.cls();
+    for (i = 0; i < n; i = i + 1) {
+        temp = floor(tmp.read());
+        lcd.locate(i,(32-(temp)));
+        lcd.printf("%.0f\n",temp);
+        wait(.1);
+        if (i == (n-10)){
+        i = 0;
         lcd.cls();
-        lcd.locate(0,3);
-        lcd.printf("%.2f\n",tmp.read());
-        wait(1.0);
+        }
+        else
+            ;
     }
+}
 
-}
+