Franz Wolf
/
app-board-LM75
BULME
main.cpp@6:4755c585b051, 2019-09-17 (annotated)
- Committer:
- wf
- Date:
- Tue Sep 17 08:52:59 2019 +0000
- Revision:
- 6:4755c585b051
- Parent:
- 5:608f2bf4d3f7
BULME
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 | |
chris | 4:6df97cb10041 | 4 | LM75B sensor(p28,p27); |
chris | 4:6df97cb10041 | 5 | Serial pc(USBTX,USBRX); |
okano | 0:ce7a8546502b | 6 | |
chris | 2:9e757151de9b | 7 | int main () |
okano | 0:ce7a8546502b | 8 | { |
wf | 6:4755c585b051 | 9 | pc.baud(9600); |
chris | 4:6df97cb10041 | 10 | //Try to open the LM75B |
chris | 4:6df97cb10041 | 11 | if (sensor.open()) { |
wf | 6:4755c585b051 | 12 | pc.printf("Device detected!\n"); |
chris | 4:6df97cb10041 | 13 | while (1) { |
wf | 6:4755c585b051 | 14 | pc.printf("Temp = %.3f\n", (float)sensor.temp()); |
chris | 4:6df97cb10041 | 15 | wait(1.0); |
chris | 4:6df97cb10041 | 16 | } |
chris | 4:6df97cb10041 | 17 | |
chris | 4:6df97cb10041 | 18 | } else { |
chris | 4:6df97cb10041 | 19 | error("Device not detected!\n"); |
chris | 2:9e757151de9b | 20 | } |
okano | 0:ce7a8546502b | 21 | |
okano | 0:ce7a8546502b | 22 | } |