werty

Dependencies:   HCSR04 Servo mbed

Fork of catchCats by eunkyoung kim

Revision:
0:7eded57f1445
Child:
1:01d1c2c9ddb1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 04 14:32:43 2013 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "HCSR04.h"
+#include "LCD40x2.h"
+
+DigitalOut led(LED_RED);
+DigitalOut led2(LED_GREEN);
+
+HCSR04 sensor(PTA12, PTD4);
+
+TextLCD lcd(PTC12, PTC16, PTC13, PTC11, PTC10, PTC6, PTC5);
+//TextLCD(PinName rs, PinName rw, PinName e, PinName d0, PinName d1, PinName d2, PinName d3, LCDType type = LCD16x2);
+
+
+int main()
+{
+    while(1){
+                long d = sensor.distance(1);
+                lcd.printf("Distance:%d ",sensor.distance(1));
+                                
+                if(d<=10)
+                {
+                led = 0;
+                led2 = 1;
+                }       
+                         
+                if(d>=200)
+                {
+                led2 = 0;
+                led = 1;
+                }
+                if(d>=11 && d<=39)
+                {
+                led2 = 0;
+                led=0;
+                }
+                
+                
+              }
+         }
+                
+                
+                
+                
+                
\ No newline at end of file