den syu / Mbed 2 deprecated prg6_2

Dependencies:   mbed

main6_2.cpp

Committer:
esemi00
Date:
2021-01-20
Revision:
0:ec16c632d97f

File content as of revision 0:ec16c632d97f:

//プログラム6_2 main6_2.cpp
#include "mbed.h"

Serial pc(USBTX, USBRX);    // PCシリアルのピン名は USBTX, USBRX
AnalogIn ond(p15);          // 温度センサ LM61 10mV/℃ 0℃ 600mV
int main() {
    float a,b,c;
   
    while(1) {
        a = ond.read();             //0(0V)~1.0(3.3V)の数値
        b = a * 3.3;                //0V ~ 3.3Vの数値
        c = b * 100 - 60;            // LM61 0.01V/℃ 0℃ 0.6V   (b - 0.6)/0.01
        pc.printf("%f V:%f ℃:%f\n", a, b, c);
        wait(1.0);
    }
}