BD1020HFV Temperature sensor test code
Dependencies: mbed
main.cpp@1:ba7e525074f9, 2016-09-08 (annotated)
- Committer:
- MikkoZ
- Date:
- Thu Sep 08 11:13:51 2016 +0000
- Revision:
- 1:ba7e525074f9
- Parent:
- 0:ee7b9cc966d7
- Child:
- 2:913fc12a42a7
Added carriage return to printout.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:ee7b9cc966d7 | 1 | #include "mbed.h" |
MACRUM | 0:ee7b9cc966d7 | 2 | |
MACRUM | 0:ee7b9cc966d7 | 3 | Serial pc(USBTX, USBRX); |
MACRUM | 0:ee7b9cc966d7 | 4 | AnalogIn sensor(A2); |
MACRUM | 0:ee7b9cc966d7 | 5 | |
MACRUM | 0:ee7b9cc966d7 | 6 | int main() { |
MACRUM | 0:ee7b9cc966d7 | 7 | float temparature; |
MACRUM | 0:ee7b9cc966d7 | 8 | pc.printf("\nBD1020HFV Temperature sensor test program.\n"); |
MACRUM | 0:ee7b9cc966d7 | 9 | while(1) { |
MACRUM | 0:ee7b9cc966d7 | 10 | temparature = -(1000 * (sensor * 3.3f) - 1546) / 8.2; |
MikkoZ | 1:ba7e525074f9 | 11 | pc.printf("Temperature=%5.3f\r\n", temparature); |
MACRUM | 0:ee7b9cc966d7 | 12 | wait(0.4); |
MACRUM | 0:ee7b9cc966d7 | 13 | } |
MACRUM | 0:ee7b9cc966d7 | 14 | } |