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

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

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okano 0:ce7a8546502b 1 #include "mbed.h"
chris 2:9e757151de9b 2 #include "LM75B.h"
chris 2:9e757151de9b 3 #include "C12832_lcd.h"
chapfohn 4:e7ecb33e5806 4 #include <math.h>
okano 0:ce7a8546502b 5
chris 2:9e757151de9b 6 C12832_LCD lcd;
chris 2:9e757151de9b 7 LM75B tmp(p28,p27);
okano 0:ce7a8546502b 8
chapfohn 4:e7ecb33e5806 9 float temp=0;
chapfohn 4:e7ecb33e5806 10 int i = 0;
chapfohn 4:e7ecb33e5806 11 int n = 129;
chapfohn 4:e7ecb33e5806 12
chris 2:9e757151de9b 13 int main ()
okano 0:ce7a8546502b 14 {
chapfohn 4:e7ecb33e5806 15 lcd.cls();
chapfohn 4:e7ecb33e5806 16 for (i = 0; i < n; i = i + 1) {
chapfohn 4:e7ecb33e5806 17 temp = floor(tmp.read());
chapfohn 4:e7ecb33e5806 18 lcd.locate(i,(32-(temp)));
chapfohn 4:e7ecb33e5806 19 lcd.printf("%.0f\n",temp);
chapfohn 4:e7ecb33e5806 20 wait(.1);
chapfohn 4:e7ecb33e5806 21 if (i == (n-10)){
chapfohn 4:e7ecb33e5806 22 i = 0;
chris 2:9e757151de9b 23 lcd.cls();
chapfohn 4:e7ecb33e5806 24 }
chapfohn 4:e7ecb33e5806 25 else
chapfohn 4:e7ecb33e5806 26 ;
chris 2:9e757151de9b 27 }
chapfohn 4:e7ecb33e5806 28 }
okano 0:ce7a8546502b 29
chapfohn 4:e7ecb33e5806 30