Basic motor code
Dependencies: Motordriver mbed HALLFX_ENCODER Servo
main.cpp@1:560118dc2f99, 2018-04-18 (annotated)
- Committer:
- jsterling30
- Date:
- Wed Apr 18 17:15:57 2018 +0000
- Revision:
- 1:560118dc2f99
- Parent:
- 0:191d0be60c80
- Child:
- 2:8c27831ce9a2
test commit and publish
Who changed what in which revision?
User | Revision | Line number | New 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 | //} |
jsterling30 | 1:560118dc2f99 | 14 | //void turnLeft() { |
jsterling30 | 1:560118dc2f99 | 15 | // |
jsterling30 | 1:560118dc2f99 | 16 | //} |
amohile3 | 0:191d0be60c80 | 17 | |
amohile3 | 0:191d0be60c80 | 18 | int main() { |
amohile3 | 0:191d0be60c80 | 19 | right.speed(0.15); |
amohile3 | 0:191d0be60c80 | 20 | left.speed(0.15); |
amohile3 | 0:191d0be60c80 | 21 | wait(5); |
amohile3 | 0:191d0be60c80 | 22 | right.speed(0.0); |
amohile3 | 0:191d0be60c80 | 23 | left.speed(0.0); |
amohile3 | 0:191d0be60c80 | 24 | } |