First Draft, serial print change based on distance

Revision:
12:b562893a1445
Parent:
11:5a895d966a3e
diff -r 5a895d966a3e -r b562893a1445 Ultrasonic/ultrasonic.h
--- a/Ultrasonic/ultrasonic.h	Thu Feb 03 17:43:32 2022 +0000
+++ b/Ultrasonic/ultrasonic.h	Thu Feb 03 18:36:34 2022 +0000
@@ -3,6 +3,43 @@
 
 #include "mbed.h"
 
+/** Ultrasonic Class
+@brief Acknowledgements to EJ Teb
+@brief  Library for interfacing with ultrasonic sensor
+
+
+Example:
+
+@code
+
+#include "mbed.h"
+#include "ultrasonic.h"
+
+ void dist(int distance)
+{
+    printf("Distance changed to %dmm\r\n", distance);
+
+    }
+
+
+ultrasonic mu(PTD0, PTC12, .1, 1, &dist);    //Set the trigger pin to PTD0 and the echo pin to PTC12
+                                        //have updates every .1 seconds and a timeout after 1
+                                        //second, and call dist when the distance changes
+
+int main()
+{
+    mu.startUpdates();//start mesuring 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.
+    }
+}
+
+
+* @endcode
+*/
 class ultrasonic
 {
     public: