TaChing Yu / Mbed 2 deprecated Wifi_LM35

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 AnalogIn lm35(A0);
00004 Serial esp8266(D6, D7);//tx, rx 
00005 
00006 int main() {
00007     float val,tempC,tempF;
00008     int i;
00009     while(1) 
00010     {
00011         val=lm35.read();
00012         tempC=(val*2.8f*100);
00013         tempF=(9.0f*tempC)/5.0f + 32.0f;
00014         printf("%.2f\n%.2f\n",tempC,tempF);
00015         i=(int)tempC;
00016         esp8266.putc(i);
00017         wait(2);
00018     }
00019 }