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:
15:9bc36f47c8cf
Parent:
14:f413a2b209b0
Child:
16:47d3b1f2e90d

File content as of revision 15:9bc36f47c8cf:

//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"
#include "MultiModalRobot.h"
 
Motor lw(p26, p29, p30, 1); // pwm, fwd, rev   LEFT WHEEL
Motor rw(p25, p28, p27, 1); // pwm, fwd, rev   RIGHT WHEEL
MultiModalRobot robot(lw, rw);
 
int main() {
    wait(5);
    for (float s= -1.0; s < 1.0 ; s += 0.01) {
       robot.driveWheels(s, -s);
       wait(0.02);
    }
    robot.stop(0.5);
}