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.
Diff: hcsr04.cpp
- Revision:
- 5:e70a24a88131
- Parent:
- 4:33938a97d904
- Child:
- 6:4be4fcd0c171
diff -r 33938a97d904 -r e70a24a88131 hcsr04.cpp
--- a/hcsr04.cpp Sat Mar 30 18:46:01 2013 +0000
+++ b/hcsr04.cpp Sat Mar 30 18:50:32 2013 +0000
@@ -71,3 +71,28 @@
{
return pulsedur;
}
+
+
+
+/*******************************************************
+ Here is a sample code usage
+*********************************************************
+#include "hcsr04.h"
+DistMeasure usensor(p25,p6);
+int main()
+{
+ unsigned char count=0;
+ while(1) {
+ usensor.start();
+ wait_ms(500);
+ dist=usensor.get_dist_cm();
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("cm:%ld",dist );
+
+ count++;
+ lcd.locate(0,1);
+ lcd.printf("Distance =%d",count);
+
+ }
+*/
\ No newline at end of file