new tam program
Dependencies: mbed C12832_lcd LCD_fonts Servo
Revision 1:b8b924f9aa15, committed 2015-01-25
- Comitter:
- cathal66
- Date:
- Sun Jan 25 21:03:54 2015 +0000
- Parent:
- 0:f3994b911c71
- Commit message:
- update;
Changed in this revision
diff -r f3994b911c71 -r b8b924f9aa15 C12832_lcd.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Sun Jan 25 21:03:54 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#0f53e522a2bf
diff -r f3994b911c71 -r b8b924f9aa15 LCD_fonts.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_fonts.lib Sun Jan 25 21:03:54 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/LCD_fonts/#d0b7d7bf1f56
diff -r f3994b911c71 -r b8b924f9aa15 Servo.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Sun Jan 25 21:03:54 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/Servo/#36b69a7ced07
diff -r f3994b911c71 -r b8b924f9aa15 main.cpp --- a/main.cpp Thu Jan 22 20:27:34 2015 +0000 +++ b/main.cpp Sun Jan 25 21:03:54 2015 +0000 @@ -1,12 +1,74 @@ + #include "mbed.h" +#include "C12832_lcd.h" +#include "Small_7.h" +#include "Arial_9.h" +#include "Servo.h" + +C12832_LCD lcd; -DigitalOut myled(LED1); +Servo s1(p21); +Servo s2(p22); + +AnalogIn p1(p17); +AnalogIn p2(p20); + +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +DigitalOut myled3(LED3); +DigitalOut myled4(LED4); int main() { while(1) { - myled = 1; + float Sonar; + + s1=p1*5; wait(0.2); - myled = 0; - wait(0.2); + + Sonar=p1*5; + + if(Sonar<=0.5) + { + myled1 = 1; + } + else + { + myled1 = 0; + } + + if(Sonar<=0.4) + { + myled2 = 1; + } + else + { + myled2 = 0; + } + + if(Sonar<=0.3) + { + myled3 = 1; + } + else + { + myled3 = 0; + } + + if(Sonar<=0.2) + { + myled4 = 1; + s2=0.1; + } + else + { + myled4 = 0; + s2=1; + } + + lcd.cls(); + lcd.locate(10,0); + lcd.set_font((unsigned char*) Arial_9); + lcd.printf("Pot Value = %f ",Sonar); + lcd.set_font((unsigned char*) Small_7); } }