TaChing Yu
/
Wifi_LM35
1
Diff: main.cpp
- Revision:
- 0:49ecbaeff0e4
- Child:
- 1:b4da0411aab0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Sep 04 07:59:19 2016 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" + +AnalogIn lm35(A0); +Serial esp8266(D6, D7);//tx, rx + +int main() { + float val,tempC,tempF; + while(1) + { + val=lm35.read(); + tempC=(val*2.8f*100); + tempF=(9.0f*tempC)/5.0f + 32.0f; + printf("%.2f\n%.2f\n",tempC,tempF); + esp8266.printf("%.2f\n%.2f\n",tempC,tempF); + wait(2); + } +}