Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Ultrasonic by
Revision 1:a8d4271903ac, committed 2014-05-26
- Comitter:
- oscargrodri
- Date:
- Mon May 26 14:12:13 2014 +0000
- Parent:
- 0:7eded57f1445
- Commit message:
- non
Changed in this revision
diff -r 7eded57f1445 -r a8d4271903ac HCSR04.lib --- a/HCSR04.lib Wed Sep 04 14:32:43 2013 +0000 +++ b/HCSR04.lib Mon May 26 14:12:13 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/aralshukaili/code/HCSR04/#0bda99bb39a4 +http://mbed.org/users/oscargrodri/code/HCSR04/#d388301a0227
diff -r 7eded57f1445 -r a8d4271903ac LCD40x2.lib --- a/LCD40x2.lib Wed Sep 04 14:32:43 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/wertyfrog/code/LCD40x2/#ca430b27054d
diff -r 7eded57f1445 -r a8d4271903ac USBDevice.lib --- a/USBDevice.lib Wed Sep 04 14:32:43 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/USBDevice/#6030a12b6c62
diff -r 7eded57f1445 -r a8d4271903ac main.cpp --- a/main.cpp Wed Sep 04 14:32:43 2013 +0000 +++ b/main.cpp Mon May 26 14:12:13 2014 +0000 @@ -1,44 +1,41 @@ #include "mbed.h" #include "HCSR04.h" -#include "LCD40x2.h" +Serial pc(USBTX, USBRX); 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 + while(1) { + int d = sensor.distance(CM); + + + pc.printf("SENSOR %d \n\r\v",d); + + + wait(0.2); + if(d<=10) { + led = 0; + led2 = 1; + } + + if(d>=40) { + led2 = 0; + led = 1; + } + if(d>=11 && d<=39) { + led2 = 0; + led=0; + } + + + + } +} + + + +