Obstacle avoider
Fork of HCSR04 by
Revision 5:e70a24a88131, committed 2013-03-30
- Comitter:
- prabhuvd
- Date:
- Sat Mar 30 18:50:32 2013 +0000
- Parent:
- 4:33938a97d904
- Child:
- 6:4be4fcd0c171
- Commit message:
- Add a sample code
Changed in this revision
| hcsr04.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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
