Franz Wolf
/
app-board-LM75
BULME
main.cpp@5:608f2bf4d3f7, 2014-02-06 (annotated)
- Committer:
- chris
- Date:
- Thu Feb 06 14:05:51 2014 +0000
- Revision:
- 5:608f2bf4d3f7
- Parent:
- 4:6df97cb10041
- Child:
- 6:4755c585b051
Modified to use the generic C12832 LCD library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
okano | 0:ce7a8546502b | 1 | #include "mbed.h" |
chris | 2:9e757151de9b | 2 | #include "LM75B.h" |
chris | 5:608f2bf4d3f7 | 3 | #include "C12832.h" |
okano | 0:ce7a8546502b | 4 | |
chris | 5:608f2bf4d3f7 | 5 | C12832 lcd(p5, p7, p6, p8, p11); |
chris | 5:608f2bf4d3f7 | 6 | |
chris | 4:6df97cb10041 | 7 | LM75B sensor(p28,p27); |
chris | 4:6df97cb10041 | 8 | Serial pc(USBTX,USBRX); |
okano | 0:ce7a8546502b | 9 | |
chris | 2:9e757151de9b | 10 | int main () |
okano | 0:ce7a8546502b | 11 | { |
okano | 0:ce7a8546502b | 12 | |
chris | 4:6df97cb10041 | 13 | //Try to open the LM75B |
chris | 4:6df97cb10041 | 14 | if (sensor.open()) { |
chris | 4:6df97cb10041 | 15 | printf("Device detected!\n"); |
chris | 4:6df97cb10041 | 16 | |
chris | 4:6df97cb10041 | 17 | while (1) { |
chris | 4:6df97cb10041 | 18 | lcd.cls(); |
chris | 4:6df97cb10041 | 19 | lcd.locate(0,3); |
chris | 4:6df97cb10041 | 20 | lcd.printf("Temp = %.3f\n", (float)sensor); |
chris | 4:6df97cb10041 | 21 | wait(1.0); |
chris | 4:6df97cb10041 | 22 | } |
chris | 4:6df97cb10041 | 23 | |
chris | 4:6df97cb10041 | 24 | } else { |
chris | 4:6df97cb10041 | 25 | error("Device not detected!\n"); |
chris | 2:9e757151de9b | 26 | } |
okano | 0:ce7a8546502b | 27 | |
okano | 0:ce7a8546502b | 28 | } |