1

Dependencies:   mbed

Committer:
yu10078999
Date:
Sun Sep 04 07:59:19 2016 +0000
Revision:
0:49ecbaeff0e4
Child:
1:b4da0411aab0
0

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 0:49ecbaeff0e4 8 while(1)
yu10078999 0:49ecbaeff0e4 9 {
yu10078999 0:49ecbaeff0e4 10 val=lm35.read();
yu10078999 0:49ecbaeff0e4 11 tempC=(val*2.8f*100);
yu10078999 0:49ecbaeff0e4 12 tempF=(9.0f*tempC)/5.0f + 32.0f;
yu10078999 0:49ecbaeff0e4 13 printf("%.2f\n%.2f\n",tempC,tempF);
yu10078999 0:49ecbaeff0e4 14 esp8266.printf("%.2f\n%.2f\n",tempC,tempF);
yu10078999 0:49ecbaeff0e4 15 wait(2);
yu10078999 0:49ecbaeff0e4 16 }
yu10078999 0:49ecbaeff0e4 17 }