HI
Dependencies: Motor TCS3472_I2C mbed
Revision 2:a681e7e4bd72, committed 2015-04-27
- Comitter:
- taylormooers
- Date:
- Mon Apr 27 01:17:48 2015 +0000
- Parent:
- 1:9eb8d4e6a719
- Commit message:
- newest version
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9eb8d4e6a719 -r a681e7e4bd72 main.cpp --- a/main.cpp Fri Apr 24 02:02:48 2015 +0000 +++ b/main.cpp Mon Apr 27 01:17:48 2015 +0000 @@ -2,8 +2,8 @@ #include "TCS3472_I2C.h" //includes the library for the RGB sensor #include "Motor.h" AnalogIn sonic(p15); -Motor R(p24, p25, p26); -Motor L(p21, p22, p23); +Motor R(p26, p30, p29); +Motor L(p25, p27, p28); float data; //ULTRASONIC SENSOR float sum; @@ -53,18 +53,18 @@ if ( (abs((1.6822*red + 15.609)-light) < 10) && (abs((4.2525*green - 37.993)-light) < 10) && (abs((6.5565*blue - 44.793 )-light) < 10) ) { colorcount[0] += 1; //car is in red L.speed(0.0); - R.speed(0.2); + R.speed(0.37); } if ( (abs((3.7757*red - 134.86)-light) < 10) && (abs((3.4282*green - 8.791 )-light) < 10) && (abs((2.5685*blue + 63.205)-light) < 10) ) { colorcount[1] += 1; //car is in blue - R.speed(0.5); - L.speed(0.5); + R.speed(0.4); + L.speed(-0.45); } if ( (abs((3.8225*red - 138.09)-light) < 10) && (abs((2.1032*green + 39.654)-light) < 10) && (abs((5.3619*blue - 2.7884)-light) < 10) ) { colorcount[2] += 1; //car is in green - L.speed(0.2); + L.speed(-0.37); R.speed(0.0); } } @@ -83,7 +83,7 @@ } if ((average> 0.014) && (average < 0.026)) { - L.speed(0.2); + L.speed(-0.2); R.speed(0.2); printf("%f \n",average); }