Ultrasonic HCSR04 values sent to a LCD 2x16

Dependencies:   HCSR04 LCD40x2 USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
DavidMeza
Date:
Wed Sep 04 14:32:43 2013 +0000
Commit message:
ultrasonic code conti

Changed in this revision

HCSR04.lib Show annotated file Show diff for this revision Revisions of this file
LCD40x2.lib Show annotated file Show diff for this revision Revisions of this file
USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 7eded57f1445 HCSR04.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HCSR04.lib	Wed Sep 04 14:32:43 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/aralshukaili/code/HCSR04/#0bda99bb39a4
diff -r 000000000000 -r 7eded57f1445 LCD40x2.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD40x2.lib	Wed Sep 04 14:32:43 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/wertyfrog/code/LCD40x2/#ca430b27054d
diff -r 000000000000 -r 7eded57f1445 USBDevice.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Wed Sep 04 14:32:43 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#6030a12b6c62
diff -r 000000000000 -r 7eded57f1445 main.cpp
--- /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
diff -r 000000000000 -r 7eded57f1445 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 04 14:32:43 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9c8f0e3462fb
\ No newline at end of file