any error pls help me debug!!!! lCD will show other word
Revision 0:810d1a280dc4, committed 2014-12-10
- Comitter:
- kenjilee92
- Date:
- Wed Dec 10 22:33:45 2014 +0000
- Commit message:
- this is the code to change the surrounding air cond by using the temperature
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Wed Dec 10 22:33:45 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Dec 10 22:33:45 2014 +0000
@@ -0,0 +1,54 @@
+#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);
+ }
+}
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Dec 10 22:33:45 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file