Test code for motors, sensors and leds

Dependencies:   PRRobot mbed

Committer:
jah128
Date:
Sat Nov 26 21:44:03 2016 +0000
Revision:
1:17d31177e3c0
Parent:
0:e0510fa64cef
Child:
2:dfd136e31aaf
Removed motor test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jah128 0:e0510fa64cef 1 #include "mbed.h"
jah128 0:e0510fa64cef 2 #include "robot.h"
jah128 0:e0510fa64cef 3
jah128 0:e0510fa64cef 4 DigitalOut myled(LED1);
jah128 0:e0510fa64cef 5 Robot robot;
jah128 0:e0510fa64cef 6
jah128 0:e0510fa64cef 7
jah128 0:e0510fa64cef 8 int main() {
jah128 0:e0510fa64cef 9 robot.init();
jah128 0:e0510fa64cef 10 motors.init();
jah128 0:e0510fa64cef 11 led.start_test();
jah128 1:17d31177e3c0 12
jah128 0:e0510fa64cef 13 while(1) {
jah128 0:e0510fa64cef 14 myled = 1;
jah128 0:e0510fa64cef 15 /*
jah128 0:e0510fa64cef 16 for(int i=0;i<8;i++){
jah128 0:e0510fa64cef 17 pc.printf("Sensor %d: %d\n",i,sensors.read_adc_value(i));
jah128 0:e0510fa64cef 18 wait(0.05);
jah128 0:e0510fa64cef 19 }
jah128 0:e0510fa64cef 20 */
jah128 0:e0510fa64cef 21
jah128 1:17d31177e3c0 22 robot.debug("Sensor 2: %d\n",sensors.get_adc_value(2));
jah128 0:e0510fa64cef 23 wait(0.1);
jah128 0:e0510fa64cef 24 myled = 0;
jah128 0:e0510fa64cef 25 wait(0.1);
jah128 0:e0510fa64cef 26 // pc.printf("V: %3.3f\n",robot.get_battery_voltage());
jah128 0:e0510fa64cef 27 }
jah128 0:e0510fa64cef 28 }