Tadao Iida
/
LCD_RoomEnv
mbed/ARM 活用事例 第2章 キャラクタLCDを極めよう
Revision 0:2bb90d5005f5, committed 2011-10-04
- Comitter:
- sunifu
- Date:
- Tue Oct 04 12:30:13 2011 +0000
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Tue Oct 04 12:30:13 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 04 12:30:13 2011 +0000 @@ -0,0 +1,64 @@ +#include "mbed.h" +#include "TextLCD.h" + +TextLCD lcd(p24, p26, p27, p28, p29, p30); +// [qÔP20©çZT[Ìlðtemp_inÉæèÞ½ßÌé¾Å·B +AnalogIn temp_in(p20); +AnalogIn humid_in(p19); + +// ZTð10[b]üúÅÄÑo·½ßÌIuWFNg +Ticker in; + + +void Update(){ + float r_temp, r_humid; + float temp,humid; + // ZT[©çlðÇÝæèÜ·B + temp = temp_in; + humid = humid_in; + + // ZT[Ìlð⳵ܷB + // 0-3.3[V]ª0.0-1.0ÉεĢé½ßAüÍlÉ3.3ðæZµd³ÉµÄA + // ³çÉ100 ðæZµ·xÉÏ·µÄ¢Ü·B + // r_temp = temp * 3.3 * 100 ; // ---- (1) + r_humid = humid * 3.3 * 100 ; + + // ZT[Ìlð⳵ܷB + // 3[V]Å50ÉÈéæ¤É6{ÌíÅüÍd³ðµÄ¢éÌÅA + // 1·xªã¸·éÆoͪ+0.06[V]ÁµÜ·B + // AnalogInÌãÀl3.3[V]ªüͳêéÆA·xÍ55ÉÈèÜ·B + // 0-3.3[V]ª0.0-1.0ÉεĢé½ßA1.0ÌüÍlÅ55ÉÈèÜ·B + // µ½ªÁÄAüÍlÉ55ð©¯éÆ·xÉÈèÜ·B + r_temp = temp * 55.0 ; // ---- (2) + + lcd.cls(); + lcd.locate(0,0); + + // printfÖÍ¢ë¢ëÆÖÉg¦éÌÅ·ªAྷéÆ·ÈÁĵܢܷB + // Úµ¢g¢ûÍAC¾ê̶@ðྵĢéz[y[WâÐÈÇŲ×ÄÝľ³¢B + // printfÖÌ""Ì̶ñªLCDÉ\¦³êÜ·B±ÌÅ%5.2f̪ÍA""ÌãÌÏÌ + // lª\¦³êÜ·B + // %5.2fÌfÍÀf[^Ì\¦ÅA%5.2Í̪SÅ5 »Ì¤¿¬_Ⱥ2 Å\¦µÜ·B + lcd.printf("RoomTemp %5.2f",r_temp); + + // PÊÌð\¦µÄ¢Ü·B + lcd.locate(14,0); + lcd.putc(0xDf); + lcd.putc(0x43); + + // \¦ÊuðºÌi̶[©çÉwèµÜ·B + lcd.locate(0,1); + // ¶¤ÉüÍlAE¤ÉüÍd³ð\¦µÄ¢Ü·B + // printf + lcd.printf("humidity%5.1f%%",r_humid); +} + +int main() { + // 10bÉZT[©çÌlðXVµÜ·B + in.attach(&Update,10); + + // ³À[vµÜ·B + while(1){ + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 04 12:30:13 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912