Grove Temp sensor Hello world example
Dependencies: Grove_temp_sensor mbed
main.cpp@0:3fa32ef93fdc, 2016-03-09 (annotated)
- Committer:
- peipei123
- Date:
- Wed Mar 09 00:00:46 2016 +0000
- Revision:
- 0:3fa32ef93fdc
- Child:
- 1:e3c235c7edaf
Hello world Example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
peipei123 | 0:3fa32ef93fdc | 1 | #include "mbed.h" |
peipei123 | 0:3fa32ef93fdc | 2 | #include "Grove_temp_sensor.h" |
peipei123 | 0:3fa32ef93fdc | 3 | AnalogIn Grove_temp_sensor(p15); |
peipei123 | 0:3fa32ef93fdc | 4 | |
peipei123 | 0:3fa32ef93fdc | 5 | int main() { |
peipei123 | 0:3fa32ef93fdc | 6 | double temp; |
peipei123 | 0:3fa32ef93fdc | 7 | while(1) { |
peipei123 | 0:3fa32ef93fdc | 8 | temp = Grove_temp_sensor.read(); |
peipei123 | 0:3fa32ef93fdc | 9 | printf("The temperature is: %5.2F C \n\r", temp); |
peipei123 | 0:3fa32ef93fdc | 10 | } |
peipei123 | 0:3fa32ef93fdc | 11 | } |