State machine code on the robot code

Dependencies:   Motordriver mbed-rtos mbed

Fork of MultiModalRobot by Baijun Desai

main.cpp

Committer:
baijun
Date:
2017-11-20
Revision:
14:f413a2b209b0
Parent:
13:4c609396ed75
Child:
15:9bc36f47c8cf

File content as of revision 14:f413a2b209b0:

//This will rotate the wheels so that after 5 seconds the robot counterclockwise and then clockwise 
#include "mbed.h"
#include "rtos.h"
#include "motordriver.h"

 
Motor lw(p26, p29, p30, 1); // pwm, fwd, rev   LEFT WHEEL
Motor rw(p25, p28, p27, 1); // pwm, fwd, rev   RIGHT WHEEL

 
int main() {
    wait(5);
    for (float s= -1.0; s < 1.0 ; s += 0.01) {
       lw.speed(s);
       rw.speed(-s); 
       wait(0.02);
    }
    lw.stop(0.5);
    rw.stop(0.5);
}