
any error pls help me debug!!!! lCD will show other word
main.cpp
- Committer:
- kenjilee92
- Date:
- 2014-12-10
- Revision:
- 0:810d1a280dc4
File content as of revision 0:810d1a280dc4:
#include "mbed.h" #include "TextLCD.h" AnalogIn LM35(p15); TextLCD lcd (p21,p22,p23,p24,p25,p26);// rs, e, d4-d7 DigitalIn PIR (p19);// DigitalOut myled (LED1); DigitalOut myled2 (LED2); int main() { float tempC; while(1) { lcd.cls(); lcd.locate(0,0); lcd.printf("Temperature:"); wait(0.5);//wait for 0.5s for the system, to detect lcd.cls(); wait(0.5); if (PIR==1) { tempC=LM35.read()*330; wait(0.2); lcd.locate(1,1); lcd.printf("%.2f deg",tempC); if(tempC>25) { myled=1; myled2=0; } else { myled2=1; myled=0; } wait(0.01); lcd.cls(); wait(0.5); } if(PIR==0) { lcd.locate(1,1); lcd.printf("no motion"); wait(0.004); lcd.cls(); wait(0.004); } } }