Colour sensors calibrated

Dependencies:   mbed-rtos mbed Servo QEI

Fork of ICRSEurobot13 by Thomas Branch

Revision:
45:77cf6375348a
Parent:
44:555136de33e4
Child:
46:adcd57a5e402
--- a/main.cpp	Fri Apr 12 16:46:42 2013 +0000
+++ b/main.cpp	Fri Apr 12 20:40:52 2013 +0000
@@ -76,28 +76,28 @@
     
     pc.baud(115200);
     
-    InitSerial();
-    wait(1);
-    Kalman::KalmanInit();
+ //   InitSerial();
+ //   wait(1);
+ //   Kalman::KalmanInit();
     
-    Thread predictthread(Kalman::predictloop, NULL, osPriorityNormal, 2084);//512); //temp 2k
-    Kalman::start_predict_ticker(&predictthread);
+ //   Thread predictthread(Kalman::predictloop, NULL, osPriorityNormal, 2084);//512); //temp 2k
+ //   Kalman::start_predict_ticker(&predictthread);
     
-    Thread updatethread(Kalman::updateloop, NULL, osPriorityNormal, 2084);
+ //   Thread updatethread(Kalman::updateloop, NULL, osPriorityNormal, 2084);
     
-    Ticker motorcontroltestticker;
-    motorcontroltestticker.attach(MotorControl::motor_control_isr, 0.05);
+ //   Ticker motorcontroltestticker;
+ //   motorcontroltestticker.attach(MotorControl::motor_control_isr, 0.05);
     // ai layer thread
-    Thread aithread(AI::ailayer, NULL, osPriorityNormal, 2048);
+ //   Thread aithread(AI::ailayer, NULL, osPriorityNormal, 2048);
     
     // motion layer periodic callback
-    RtosTimer motion_timer(motion::motionlayer, osTimerPeriodic);
-    motion_timer.start(50);
+ //   RtosTimer motion_timer(motion::motionlayer, osTimerPeriodic);
+ //   motion_timer.start(50);
 
-    Thread printingThread(Printing::printingloop, NULL, osPriorityLow, 2048);
+ //   Thread printingThread(Printing::printingloop, NULL, osPriorityLow, 2048);
 
-    measureCPUidle(); //repurpose thread for idle measurement
-    //colourtest();
+ //   measureCPUidle(); //repurpose thread for idle measurement
+    colourtest();
     //pt_test();
     while(true) {
     Thread::wait(osWaitForever);
@@ -174,14 +174,13 @@
 
 void colourtest()
 {
-    //Colour c(P_COLOR_SENSOR_BLUE, P_COLOR_SENSOR_RED, P_COLOR_SENSOR_IN,UPPER);
-    Colour c(P_COLOR_SENSOR_BLUE_LOWER, P_COLOR_SENSOR_RED_LOWER, P_COLOR_SENSOR_IN_LOWER,LOWER);
+    Colour c_upper(P_COLOR_SENSOR_BLUE_UPPER, P_COLOR_SENSOR_RED_UPPER, P_COLOR_SENSOR_IN_UPPER,UPPER);
+    Colour c_lower(P_COLOR_SENSOR_BLUE_LOWER, P_COLOR_SENSOR_RED_LOWER, P_COLOR_SENSOR_IN_LOWER,LOWER);
 
     while(true) {
         wait(0.1);
 
-        ColourEnum ce = c.getColour();
-        switch(ce) {
+        switch(c_lower.getColour()) {
             case BLUE :
                 printf("BLUE\n");
                 break;
@@ -206,7 +205,7 @@
 {
     DigitalOut _blue_led(p10);
     DigitalOut _red_led(p11);
-    AnalogIn _pt(p19);
+    AnalogIn _pt(p18);
     
     bytepack_t datapackage;
     // first 3 bytes of header is used for alignment