Test code for motors, sensors and leds

Dependencies:   PRRobot mbed

Committer:
jah128
Date:
Mon Nov 28 22:41:25 2016 +0000
Revision:
3:d42f51bcf883
Parent:
2:dfd136e31aaf
Child:
4:31e5dfbe68e8
Added first RPi input;

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 Robot robot;
jah128 0:e0510fa64cef 5
jah128 0:e0510fa64cef 6 int main() {
jah128 0:e0510fa64cef 7 robot.init();
jah128 1:17d31177e3c0 8
jah128 0:e0510fa64cef 9 while(1) {
jah128 2:dfd136e31aaf 10 mbed_led1 = 1;
jah128 0:e0510fa64cef 11 /*
jah128 0:e0510fa64cef 12 for(int i=0;i<8;i++){
jah128 0:e0510fa64cef 13 pc.printf("Sensor %d: %d\n",i,sensors.read_adc_value(i));
jah128 0:e0510fa64cef 14 wait(0.05);
jah128 0:e0510fa64cef 15 }
jah128 0:e0510fa64cef 16 */
jah128 0:e0510fa64cef 17
jah128 3:d42f51bcf883 18 //robot.debug("Sensor 2: %d\n",sensors.get_adc_value(2));
jah128 0:e0510fa64cef 19 wait(0.1);
jah128 2:dfd136e31aaf 20 mbed_led1 = 0;
jah128 0:e0510fa64cef 21 wait(0.1);
jah128 3:d42f51bcf883 22
jah128 3:d42f51bcf883 23 motors.set_left_motor_speed(0.25);
jah128 3:d42f51bcf883 24 robot.update_status_message();
jah128 3:d42f51bcf883 25 robot.debug("Status message:[");
jah128 3:d42f51bcf883 26 for(int i=0;i<16;i++){
jah128 3:d42f51bcf883 27 robot.debug("%2X ",status_message[i]);
jah128 3:d42f51bcf883 28 }
jah128 3:d42f51bcf883 29
jah128 3:d42f51bcf883 30 robot.debug("]\n");
jah128 3:d42f51bcf883 31
jah128 3:d42f51bcf883 32
jah128 0:e0510fa64cef 33 // pc.printf("V: %3.3f\n",robot.get_battery_voltage());
jah128 0:e0510fa64cef 34 }
jah128 0:e0510fa64cef 35 }