エレキジャック Web版 mbedで初めてのマイコン開発 LCDを極める!<3/5> 温度センサ(LM35)を使ってLCDに温度を表示するプログラムです。 http://www.eleki-jack.com/arm/2010/11/mbed-lcd-2.html
main.cpp@0:8c1e9715121a, 2011-03-02 (annotated)
- Committer:
- sunifu
- Date:
- Wed Mar 02 13:27:07 2011 +0000
- Revision:
- 0:8c1e9715121a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sunifu | 0:8c1e9715121a | 1 | #include "mbed.h" |
sunifu | 0:8c1e9715121a | 2 | #include "TextLCD.h" |
sunifu | 0:8c1e9715121a | 3 | |
sunifu | 0:8c1e9715121a | 4 | TextLCD lcd(p24, p26, p27, p28, p29, p30); |
sunifu | 0:8c1e9715121a | 5 | AnalogIn temp_in(p20); |
sunifu | 0:8c1e9715121a | 6 | |
sunifu | 0:8c1e9715121a | 7 | int main() { |
sunifu | 0:8c1e9715121a | 8 | float r_temp, temp; |
sunifu | 0:8c1e9715121a | 9 | while(1){ |
sunifu | 0:8c1e9715121a | 10 | temp = temp_in ; |
sunifu | 0:8c1e9715121a | 11 | r_temp = temp *3.3 * 100.0 ; |
sunifu | 0:8c1e9715121a | 12 | //r_temp = temp_in * 55.0 ; |
sunifu | 0:8c1e9715121a | 13 | lcd.cls(); |
sunifu | 0:8c1e9715121a | 14 | lcd.locate(0,0); |
sunifu | 0:8c1e9715121a | 15 | lcd.printf("RoomTemp %5.2f",r_temp); |
sunifu | 0:8c1e9715121a | 16 | lcd.locate(14,0); |
sunifu | 0:8c1e9715121a | 17 | lcd.putc(0xDf); |
sunifu | 0:8c1e9715121a | 18 | lcd.putc(0x43); |
sunifu | 0:8c1e9715121a | 19 | |
sunifu | 0:8c1e9715121a | 20 | lcd.locate(0,1); |
sunifu | 0:8c1e9715121a | 21 | lcd.printf("%5.3f %5.3f[V]",temp, temp*3.3); |
sunifu | 0:8c1e9715121a | 22 | wait(5); |
sunifu | 0:8c1e9715121a | 23 | } |
sunifu | 0:8c1e9715121a | 24 | } |