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.
Revision 0:4ed911d89030, committed 2019-06-07
- Comitter:
- ec30109b
- Date:
- Fri Jun 07 05:07:15 2019 +0000
- Commit message:
- urtrasonic
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HCSR04.lib Fri Jun 07 05:07:15 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/prabhuvd/code/HCSR04/#71da0dbf4400
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Jun 07 05:07:15 2019 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+#include "hcsr04.h"
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+HCSR04 usensor(D4, D6); // Trigger(DO), Echo(PWMIN)
+
+DigitalOut led(D2);
+
+int main()
+{
+ pc.printf("Start!\n\r");
+ while(1) {
+ usensor.start();
+ unsigned int dist = usensor.get_dist_cm();
+ pc.printf("cm:%ld\r\n",dist );
+
+ if(dist >= 20 && dist <= 60){
+ led = 1;
+ }else{
+ led = 0;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 07 05:07:15 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file