State machine code on the robot code

Dependencies:   Motordriver mbed-rtos mbed

Fork of MultiModalRobot by Baijun Desai

Committer:
baijun
Date:
Mon Nov 20 00:53:05 2017 +0000
Revision:
13:4c609396ed75
Parent:
11:0309bef74ba8
Child:
14:f413a2b209b0
Sweep motor for 1 wheel;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
baijun 13:4c609396ed75 1 // Sweep the motor speed from full-speed reverse (-1.0) to full speed forwards (1.0)
baijun 13:4c609396ed75 2
emilmont 1:491820ee784d 3 #include "mbed.h"
mbed_official 11:0309bef74ba8 4 #include "rtos.h"
baijun 13:4c609396ed75 5 #include "Motor.h"
baijun 13:4c609396ed75 6
emilmont 1:491820ee784d 7
baijun 13:4c609396ed75 8 Motor m(p26, p29, p30); // pwm, fwd, rev
emilmont 1:491820ee784d 9
emilmont 1:491820ee784d 10 int main() {
baijun 13:4c609396ed75 11 for (float s= -1.0; s < 1.0 ; s += 0.01) {
baijun 13:4c609396ed75 12 m.speed(s);
baijun 13:4c609396ed75 13 wait(0.02);
emilmont 1:491820ee784d 14 }
baijun 13:4c609396ed75 15 }