Checking temperature

Dependencies:   mbed

Committer:
umezawa
Date:
Tue Dec 29 05:31:51 2020 +0000
Revision:
0:b6605fb3b120
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
umezawa 0:b6605fb3b120 1 #include "mbed.h"
umezawa 0:b6605fb3b120 2 Serial pc(USBTX, USBRX);
umezawa 0:b6605fb3b120 3 AnalogIn tem(A6);
umezawa 0:b6605fb3b120 4 DigitalOut conv(A3);
umezawa 0:b6605fb3b120 5
umezawa 0:b6605fb3b120 6 int main()
umezawa 0:b6605fb3b120 7 {
umezawa 0:b6605fb3b120 8 double temper;
umezawa 0:b6605fb3b120 9 conv = 1;
umezawa 0:b6605fb3b120 10 wait(0.5);
umezawa 0:b6605fb3b120 11 for(int i = 0; i<10; i++) {
umezawa 0:b6605fb3b120 12 temper = (tem.read()*3.3-0.6)*100;
umezawa 0:b6605fb3b120 13 pc.printf("Tem=%f\r\n",temper);
umezawa 0:b6605fb3b120 14 wait(0.5);
umezawa 0:b6605fb3b120 15 }
umezawa 0:b6605fb3b120 16 }