Sample code for using the rangefinder.

Dependencies:   ISR_Mini-explorer_tmp

Revision:
0:1750d1fd5e73
diff -r 000000000000 -r 1750d1fd5e73 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 19 15:36:56 2018 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+#include "robot.h" // Inicializa o robô. Este include deverá ser usado em todos os main.cpp!
+#include "Radio.h"
+#include "Rangefinder.h"
+
+int main()
+{
+    initRobot(124);
+    init_rangefinder(&i2c1, &mutex_i2c1);
+
+    while(1) {
+        if( read_rangefinder() == 0 ) {
+            for(int i = 0; i < 16; i++) {
+                if(rgfMeasurements[i] > 1270)
+                    pc.printf("%d=%u ", i, 0);
+                else
+                    pc.printf("%d=%u ", i, rgfMeasurements[i]);
+            }
+            pc.printf("\n");
+        }
+
+        wait(1);
+    }
+}