m3Dpi robot, based on the Pololu 3pi and m3pi. m3Dpi has multiple distance sensors, gyroscope, compass and accelerometer sensor to be fully aware of its environment. With the addition of xbee or nrf24n01 module it has wireless communication capabilities.

Dependencies:   m3Dpi mbed-rtos mbed MbedJSONValue

Revision:
17:b73fcdb828f3
Parent:
16:0043244f8a61
--- a/main.cpp	Wed Jan 20 17:57:05 2016 +0000
+++ b/main.cpp	Wed Aug 30 11:54:19 2017 +0000
@@ -21,7 +21,11 @@
     int colors[8] = {distance.front, distance.front_right, distance.right, distance.back_right, distance.back, distance.back_left, distance.left, distance.front_left};
     // shift distance value to get red colors
     for(int i = 0; i < 8; i++){
-        colors[i] = ((~(colors[i]*2)) & 0xFF) << 16;
+        //colors[i] = ((~(colors[i]*2)) & 0xFF) << 16;
+        if(colors[i] < 50) {colors[i] = Color::RED;}
+        else if(colors[i] < 100) {colors[i] = Color::YELLOW;}
+        else if(colors[i] < 150) {colors[i] = Color::GREEN;}
+        else{colors[i] = Color::BLACK;}
     }
     robot.setLeds(colors);
 }
@@ -29,13 +33,13 @@
 void read_sensors_task(void const *name)
 {
     //Timer t; t.start();
-    robot.setStatus(Color::GREEN);
+    robot.setStatus(Color::BLACK);
     ::distance = robot.getDistance();
-    direction = robot.getDirection();
-    rotation = robot.getRotation();
-    acceleration = robot.getAcceleration();
+    //direction = robot.getDirection();
+    //rotation = robot.getRotation();
+    //acceleration = robot.getAcceleration();
     setLeds(::distance);
-    robot.setStatus(Color::BLACK);
+    robot.setStatus(Color::RED);
     //t.stop();pc.printf("*** Sensor acquisition time: %d us\r\n", t.read_us());
 }
 
@@ -67,10 +71,10 @@
     read_sensors_timer.start(50);
     
     RtosTimer report_timer(report_task, osTimerPeriodic);
-    report_timer.start(500);
+//    report_timer.start(500);
     
-    Thread receive_thread(receive_task);
-    Thread idle_thread(idle_task, NULL, osPriorityLow);
+//    Thread receive_thread(receive_task);
+//    Thread idle_thread(idle_task, NULL, osPriorityLow);
     
     Thread::wait(osWaitForever);
 }
\ No newline at end of file