![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Test code for motors, sensors and leds
Diff: main.cpp
- Revision:
- 1:17d31177e3c0
- Parent:
- 0:e0510fa64cef
- Child:
- 2:dfd136e31aaf
diff -r e0510fa64cef -r 17d31177e3c0 main.cpp --- a/main.cpp Sat Nov 26 17:29:53 2016 +0000 +++ b/main.cpp Sat Nov 26 21:44:03 2016 +0000 @@ -6,28 +6,10 @@ int main() { - pc.baud(115200); - pc.printf("PR Robot\n"); robot.init(); motors.init(); led.start_test(); - - while(1){ - for(int i=1;i<100;i++){ - pc.printf("Speed: %1.2f [I=%2.4f] \n",0.01*i,motors.get_current_left()); - motors.set_left_motor_speed(0.01 * i); - wait(0.5); - } - motors.brake(); - wait(0.5); - for(int i=1;i<100;i++){ - pc.printf("Speed: -%1.2f [I=%2.4f] \n",0.01*i,motors.get_current_left()); - motors.set_left_motor_speed(-0.01 * i); - wait(0.5); - } - motors.coast(); - wait(0.5); - } + while(1) { myled = 1; /* @@ -37,7 +19,7 @@ } */ - pc.printf("Sensor 2: %d\n",sensors.get_adc_value(2)); + robot.debug("Sensor 2: %d\n",sensors.get_adc_value(2)); wait(0.1); myled = 0; wait(0.1);