Basic motor code

Dependencies:   Motordriver mbed HALLFX_ENCODER Servo

Committer:
amohile3
Date:
Wed Apr 18 17:11:55 2018 +0000
Revision:
0:191d0be60c80
Child:
1:560118dc2f99
Basic motor code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
amohile3 0:191d0be60c80 1 #include "mbed.h"
amohile3 0:191d0be60c80 2 #include "motordriver.h"
amohile3 0:191d0be60c80 3
amohile3 0:191d0be60c80 4 Motor right(p23,p5,p6, 1); // pwm, fwd, rev
amohile3 0:191d0be60c80 5 Motor left(p21, p7, p8, 1); // pwm, fwd, rev
amohile3 0:191d0be60c80 6
amohile3 0:191d0be60c80 7 //void forward(int distance) {
amohile3 0:191d0be60c80 8 //
amohile3 0:191d0be60c80 9 //}
amohile3 0:191d0be60c80 10 //
amohile3 0:191d0be60c80 11 //void reverse(int distance) {
amohile3 0:191d0be60c80 12 //
amohile3 0:191d0be60c80 13 //}
amohile3 0:191d0be60c80 14
amohile3 0:191d0be60c80 15 int main() {
amohile3 0:191d0be60c80 16 right.speed(0.15);
amohile3 0:191d0be60c80 17 left.speed(0.15);
amohile3 0:191d0be60c80 18 wait(5);
amohile3 0:191d0be60c80 19 right.speed(0.0);
amohile3 0:191d0be60c80 20 left.speed(0.0);
amohile3 0:191d0be60c80 21 }