code for the speed robot

Dependencies:   MPU6050-DMP mbed PololuQTRSensors vl53l0x

Revision:
6:a635edf31d8b
Parent:
5:bb0763ae79ff
--- a/tof.h	Mon Sep 30 10:37:06 2019 +0000
+++ b/tof.h	Mon Sep 30 11:16:12 2019 +0000
@@ -2,44 +2,24 @@
 {
     DigitalOut xshut1(XSHUT_pin1);
     DigitalOut xshut2(XSHUT_pin2);
-    DigitalOut xshut3(XSHUT_pin3);
-
-    DigitalIn xshut3_(XSHUT_pin3);
-    wait(0.01);
+    xshut1 = 0;
+    xshut2 = 0;
+    
     Sensor3.setAddress(Sensor3_newAddress);
-
-    DigitalIn xshut2_(XSHUT_pin2);
-    wait(0.01);
-    Sensor2.setAddress(Sensor2_newAddress);
-
-    DigitalIn xshut1_(XSHUT_pin1);
-    wait(0.01);
-    Sensor1.setAddress(Sensor1_newAddress);
+    printf("sensor3: %d\n",Sensor3.getAddress());
+    xshut2 = 1;
+    wait_ms(10);
     
-    if (Sensor1.init())
-    {
-        PrintSerial("Sensor 1 : Configured");
-    }
-    else
-    {
-        PrintSerial("Sensor 1 : Configuration Failed");
-    }
-    if (Sensor2.init())
-    {
-        PrintSerial("Sensor 2 : Configured");
-    }
-    else
-    {
-        PrintSerial("Sensor 2 : Configuration Failed");
-    }
-    if (Sensor3.init())
-    {
-        PrintSerial("Sensor 3 : Configured");
-    }
-    else
-    {
-        PrintSerial("Sensor 3 : Configuration Failed");
-    }
+    Sensor2.setAddress(Sensor2_newAddress);
+    printf("sensor2: %d sensor3: %d\n",Sensor2.getAddress(),Sensor3.getAddress());
+    xshut1 = 1;
+    wait_ms(10);
+    
+    printf("sensor1: %d sensor2: %d sensor3: %d\n",Sensor1.getAddress(),Sensor2.getAddress(),Sensor3.getAddress());
+    
+    Sensor1.init();
+    Sensor2.init();
+    Sensor3.init();
 
     Sensor1.setSignalRateLimit(SignalRateLimit);
     Sensor2.setSignalRateLimit(SignalRateLimit);