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.
Dependencies: HCSR04 TextLCD mbed
Revision 0:808573894e45, committed 2016-10-24
- Comitter:
- DrMirko
- Date:
- Mon Oct 24 12:46:39 2016 +0000
- Commit message:
- 4n4
Changed in this revision
diff -r 000000000000 -r 808573894e45 HCSR04.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HCSR04.lib Mon Oct 24 12:46:39 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/BDD/code/HCSR04/#b33371d06155
diff -r 000000000000 -r 808573894e45 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Mon Oct 24 12:46:39 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r 808573894e45 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Oct 24 12:46:39 2016 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include "HCSR04.h"
+
+TextLCD lcd(D12, D11, D5, D4, D3, D2, TextLCD::LCD16x2); // rs, e, d4-d7
+DigitalOut myled(LED1);
+
+int main()
+{
+ lcd.printf("Distance Calculator.");
+ wait(1);
+ lcd.cls();
+ lcd.locate(0,0);
+ HCSR04 sensor(D7, D8); //echo pin, trig pin
+ sensor.setRanges(1, 150);
+ lcd.printf("Min. = %g cm", sensor.getMinRange());
+ lcd.locate(0,1);
+ lcd.printf("Max. = %g cm",sensor.getMaxRange());
+ wait(2);
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("Distance: ");
+ while(1) {
+ lcd.locate(0,1);
+ lcd.printf("%5.3f cm", sensor.getDistance_cm());
+ wait_ms(1000);
+ lcd.locate(0,1);
+ lcd.printf(" ");
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 808573894e45 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 24 12:46:39 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file