motor

Dependencies:   Motor mbed

Fork of Motor_HelloWorld by Simon Ford

main.cpp

Committer:
ycai47
Date:
2015-09-05
Revision:
1:1997f5ee08bc
Parent:
0:7bbc230e00d6

File content as of revision 1:1997f5ee08bc:

// Sweep the motor speed from full-speed reverse (-1.0) to full speed forwards (1.0)

#include "mbed.h"
#include "Motor.h"

AnalogIn pot(p20);
Motor m(p25, p6, p5); // pwm, fwd, rev

int main() {
    while (true)
    {
       m.speed((pot-1.65f)/1.65f);
       wait(0.02);
    }
}