Farbod Jam / Mbed 2 deprecated GOLOOMOTOR

Dependencies:   mbed

main.cpp

Committer:
farbodjam
Date:
2011-08-11
Revision:
0:cc4cc8826661
Child:
1:482da73abda8

File content as of revision 0:cc4cc8826661:

#include "mbed.h"
#include "motordriver.h"

Serial pc(USBTX, USBRX); // tx, rx
Motor A(p22, p6, p5, 1); // pwm, fwd, rev, can brake 
Motor B(p21, p7, p8, 1); // pwm, fwd, rev, can brake
 float s = 0.00;
 int main() {

 pc.printf("Press 'u' to turn motor1 speed up, 'd' to turn it down\n");
    while(1) {
        char c = pc.getc();
        if((c == 'u') && (s < 2.5)) {
                    s += 0.01;
        A.speed(s); 
        B.speed(s); 
        wait(0.02);
    }
            if((c == 'd') && (s > 0.0)) {
            s -= 0.01;
    A.stop(1);
    B.stop(1);
    wait(0.02);
     }
     }
     }