1

Dependencies:   mbed

Committer:
yu10078999
Date:
Sun Sep 04 08:50:23 2016 +0000
Revision:
2:a5d1974bd7c9
Parent:
1:b4da0411aab0
3

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yu10078999 0:49ecbaeff0e4 1 #include "mbed.h"
yu10078999 0:49ecbaeff0e4 2
yu10078999 0:49ecbaeff0e4 3 AnalogIn lm35(A0);
yu10078999 0:49ecbaeff0e4 4 Serial esp8266(D6, D7);//tx, rx
yu10078999 0:49ecbaeff0e4 5
yu10078999 0:49ecbaeff0e4 6 int main() {
yu10078999 0:49ecbaeff0e4 7 float val,tempC,tempF;
yu10078999 2:a5d1974bd7c9 8 int i;
yu10078999 0:49ecbaeff0e4 9 while(1)
yu10078999 0:49ecbaeff0e4 10 {
yu10078999 0:49ecbaeff0e4 11 val=lm35.read();
yu10078999 0:49ecbaeff0e4 12 tempC=(val*2.8f*100);
yu10078999 0:49ecbaeff0e4 13 tempF=(9.0f*tempC)/5.0f + 32.0f;
yu10078999 0:49ecbaeff0e4 14 printf("%.2f\n%.2f\n",tempC,tempF);
yu10078999 2:a5d1974bd7c9 15 i=(int)tempC;
yu10078999 1:b4da0411aab0 16 esp8266.putc(i);
yu10078999 0:49ecbaeff0e4 17 wait(2);
yu10078999 0:49ecbaeff0e4 18 }
yu10078999 0:49ecbaeff0e4 19 }