init

Dependencies:   HCSR04 HC_SR04_Ultrasonic_Library Ultrasonic mbed

Files at this revision

API Documentation at this revision

Comitter:
emanuel22e
Date:
Fri Oct 14 19:32:28 2022 +0000
Commit message:
init

Changed in this revision

HCSR04.lib Show annotated file Show diff for this revision Revisions of this file
HC_SR04_Ultrasonic_Library.lib Show annotated file Show diff for this revision Revisions of this file
Ultrasonic.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 236e34a7c050 HCSR04.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HCSR04.lib	Fri Oct 14 19:32:28 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/aralshukaili/code/HCSR04/#0bda99bb39a4
diff -r 000000000000 -r 236e34a7c050 HC_SR04_Ultrasonic_Library.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HC_SR04_Ultrasonic_Library.lib	Fri Oct 14 19:32:28 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/ejteb/code/HC_SR04_Ultrasonic_Library/#e0f9c9fb4cf3
diff -r 000000000000 -r 236e34a7c050 Ultrasonic.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ultrasonic.lib	Fri Oct 14 19:32:28 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/leejong87/code/Ultrasonic/#d8a93321fc01
diff -r 000000000000 -r 236e34a7c050 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Oct 14 19:32:28 2022 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+#include "ultrasonic.h"
+Serial pc(USBTX, USBRX);
+ 
+ void dist(int distance)
+{
+    //put code here to execute when the distance has changed
+    pc.printf("Distance %d mm\r\n", distance);
+}
+ 
+ultrasonic mu(p6, p7, .1, 1, &dist);    //Set the trigger pin to p6 and the echo pin to p7
+                                        //have updates every .1 seconds and a timeout after 1
+                                        //second, and call dist when the distance changes
+ 
+int main()
+{
+    mu.startUpdates();//start measuring the distance
+    while(1)
+    {
+        //Do something else here
+        mu.checkDistance();     //call checkDistance() as much as possible, as this is where
+                                //the class checks if dist needs to be called.
+    }
+}
diff -r 000000000000 -r 236e34a7c050 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Oct 14 19:32:28 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file