Rob Toulson
/
RealTimeLab08_TempDisplay
Real Time Lab Program
Revision 0:bc00a9403da0, committed 2015-01-25
- Comitter:
- robt
- Date:
- Sun Jan 25 16:30:48 2015 +0000
- Commit message:
- Real Time Lab Program
Changed in this revision
diff -r 000000000000 -r bc00a9403da0 C12832_lcd.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Sun Jan 25 16:30:48 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
diff -r 000000000000 -r bc00a9403da0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jan 25 16:30:48 2015 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" +#include "C12832_lcd.h" + +C12832_LCD lcd; +I2C i2c(p28, p27); + +const int addr = 0x90; + +int main() { + char cmd[2]; + while (1) { + cmd[0] = 0x01; + cmd[1] = 0x00; + i2c.write(addr, cmd, 2); + + wait(0.5); + + cmd[0] = 0x00; + i2c.write(addr, cmd, 1); + i2c.read(addr, cmd, 2); + + float tmp = (float((cmd[0]<<8)|cmd[1]) / 256.0); + lcd.locate(2,5); + lcd.printf("Temperature = %.2f degC", tmp); + } +}
diff -r 000000000000 -r bc00a9403da0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Jan 25 16:30:48 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file