温度センサ

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 
00004 AnalogIn LM60(p15);
00005 TextLCD lcd(p24, p26, p27, p28, p29, p30);
00006 
00007 /////////////////////////////////////////////////////
00008 //      main
00009 /////////////////////////////////////////////////////
00010 int main(void) {
00011         float a_in , tempC ;
00012     lcd.cls();
00013 
00014     while(1) {
00015         a_in = (LM60);
00016         tempC = (  ( a_in * 3.3 ) - 0.424  ) * 160.0 ;
00017         lcd.locate(0,0);
00018         lcd.printf("%5.2F C %5.3F V ", tempC, a_in);
00019         wait(.5);
00020     }
00021 
00022     return 0;
00023 }