エレキジャック Web版 mbedで初めてのマイコン開発 LCDを極める!<3/5> 温度センサ(LM35)を使ってLCDに温度を表示するプログラムです。 http://www.eleki-jack.com/arm/2010/11/mbed-lcd-2.html
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 00004 TextLCD lcd(p24, p26, p27, p28, p29, p30); 00005 AnalogIn temp_in(p20); 00006 00007 int main() { 00008 float r_temp, temp; 00009 while(1){ 00010 temp = temp_in ; 00011 r_temp = temp *3.3 * 100.0 ; 00012 //r_temp = temp_in * 55.0 ; 00013 lcd.cls(); 00014 lcd.locate(0,0); 00015 lcd.printf("RoomTemp %5.2f",r_temp); 00016 lcd.locate(14,0); 00017 lcd.putc(0xDf); 00018 lcd.putc(0x43); 00019 00020 lcd.locate(0,1); 00021 lcd.printf("%5.3f %5.3f[V]",temp, temp*3.3); 00022 wait(5); 00023 } 00024 }
Generated on Thu Jul 14 2022 22:20:52 by 1.7.2