Robot team project

Dependencies:   QEI Motordriver ros_lib_melodic

Revision:
1:d5adc483bce0
Parent:
0:57855aafa907
Child:
2:c537f1ebad7b
diff -r 57855aafa907 -r d5adc483bce0 main.cpp
--- a/main.cpp	Tue Oct 22 09:12:03 2019 +0000
+++ b/main.cpp	Tue Oct 22 09:41:35 2019 +0000
@@ -20,18 +20,15 @@
 
 int main() {
     int range1; 
-    int range2=0;
+    int range2;
     int range3=0;
     int range4=0; 
     
     // Create and init sensor 1
-    Sensor sensor1(ADDR1, I2C_SDA, I2C_SCL, PC_9);
-    
-    /*
-    Sensor sensor2(ADDR2, I2C_SDA, I2C_SCL, PC_11);
-    Sensor sensor3(ADDR3, I2C_SDA, I2C_SCL, PD_2);
-    Sensor sensor4(ADDR4, I2C_SDA, I2C_SCL, PG_3);
-    */
+    Sensor sensor1(I2C_SDA, I2C_SCL, PC_9);
+    Sensor sensor2(I2C_SDA, I2C_SCL, PC_11);
+    //Sensor sensor3(I2C_SDA, I2C_SCL, PD_2);
+    //Sensor sensor4(I2C_SDA, I2C_SCL, PG_3);
  
     /*
     SHDN_1 = 0;
@@ -39,14 +36,38 @@
     SHDN_2 = 0;
     SHDN_4 = 0;
     wait_ms(0.5);
+    */
+    sensor1.turnOff();
+    sensor2.turnOff();
+   // sensor3.turnOff();
+   // sensor4.turnOff();
+    wait_ms(0.5);
  
+    sensor1.turnOff();
+    sensor2.turnOn();
+   // sensor3.turnOff();
+    //sensor4.turnOff();
+    
+    /*
     SHDN_1 = 0;
     SHDN_2 = 1;
     SHDN_3 = 0;
     SHDN_4 = 0;
     */
     
-
+    sensor2.init();
+    sensor2.changeAddress(ADDR2);
+    /*
+    sensor3.turnOn();
+    sensor3.init();
+    sensor3.changeAddress(ADDR3);
+    
+    sensor4.turnOn();
+    sensor4.init();
+    sensor4.changeAddress(ADDR4);
+    */
+    sensor1.turnOn();
+    sensor1.init();
     /*
     // load settings onto VL6180X sensors    
     VL6180_Init(ADDR1);
@@ -70,12 +91,9 @@
     while (1)
     {            
         range1 = sensor1.read();
-
-        /*
         range2 = sensor2.read();
-        range3 = sensor3.read();
-        range4 = sensor4.read();         
-        */
+        //range3 = sensor3.read();
+        //range4 = sensor4.read();         
 
         pc.printf("Range one = %d | range two = %d | range three = %d | range four = %d\r\n",range1, range2, range3, range4);       
         wait_ms(100);