Exemple 1 CRTI
Dependencies: C12832 LM75B mbed
Fork of app-board-LM75B by
main.cpp@4:6df97cb10041, 2013-10-29 (annotated)
- Committer:
- chris
- Date:
- Tue Oct 29 06:51:26 2013 +0000
- Revision:
- 4:6df97cb10041
- Parent:
- 3:4d612f16ad84
- Child:
- 5:608f2bf4d3f7
Updated to use Component database library for LM75BD
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 | 2:9e757151de9b | 3 | #include "C12832_lcd.h" |
okano | 0:ce7a8546502b | 4 | |
chris | 2:9e757151de9b | 5 | C12832_LCD lcd; |
chris | 4:6df97cb10041 | 6 | LM75B sensor(p28,p27); |
chris | 4:6df97cb10041 | 7 | Serial pc(USBTX,USBRX); |
okano | 0:ce7a8546502b | 8 | |
chris | 2:9e757151de9b | 9 | int main () |
okano | 0:ce7a8546502b | 10 | { |
okano | 0:ce7a8546502b | 11 | |
chris | 4:6df97cb10041 | 12 | //Try to open the LM75B |
chris | 4:6df97cb10041 | 13 | if (sensor.open()) { |
chris | 4:6df97cb10041 | 14 | printf("Device detected!\n"); |
chris | 4:6df97cb10041 | 15 | |
chris | 4:6df97cb10041 | 16 | while (1) { |
chris | 4:6df97cb10041 | 17 | lcd.cls(); |
chris | 4:6df97cb10041 | 18 | lcd.locate(0,3); |
chris | 4:6df97cb10041 | 19 | lcd.printf("Temp = %.3f\n", (float)sensor); |
chris | 4:6df97cb10041 | 20 | wait(1.0); |
chris | 4:6df97cb10041 | 21 | } |
chris | 4:6df97cb10041 | 22 | |
chris | 4:6df97cb10041 | 23 | } else { |
chris | 4:6df97cb10041 | 24 | error("Device not detected!\n"); |
chris | 2:9e757151de9b | 25 | } |
okano | 0:ce7a8546502b | 26 | |
okano | 0:ce7a8546502b | 27 | } |