Library for the SRF02 ultrasonic rangefinder

Dependencies:   mbed

Revision:
0:862f11d627f9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Jul 10 16:40:35 2011 +0000
@@ -0,0 +1,30 @@
+//Useage example for the SRF02 Library
+
+#include "mbed.h"
+#include "SRF02.h"
+
+
+Serial debugport(USBTX,USBRX);
+SRF02 mySensor(p9,p10,0xE0);
+
+
+
+
+main() {
+
+    time_t seconds = time(NULL); //Internal RTC
+    debugport.baud(115200); //set the buadrate (default is 9600 if this command is not used)
+    debugport.format(8,Serial::None,1); //config the serial port (default is 8N1)
+    debugport.printf("Hello World! %d \r\n", seconds); //send a message out of the serial port to check all is well
+    //include a time stamp for reference (seconds since power up)
+
+
+    while (1) {
+
+
+        debugport.printf("current distance: %.2f cm. (v2) \r\n", mySensor.measurecm());
+        debugport.printf("current distance: %.2f inches.\r\n", mySensor.measurein());
+        debugport.printf("current flightime: %.2f microseconds.\r\n", mySensor.measureus());
+
+    }
+}