1

Dependencies:   mbed

main.cpp

Committer:
yu10078999
Date:
2016-09-04
Revision:
1:b4da0411aab0
Parent:
0:49ecbaeff0e4
Child:
2:a5d1974bd7c9

File content as of revision 1:b4da0411aab0:

#include "mbed.h"

AnalogIn lm35(A0);
Serial esp8266(D6, D7);//tx, rx 
char i;

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);
        i=tempC;
        esp8266.putc(i);
        wait(2);
    }
}