j
Fork of Motordriver by
motortest.cpp@6:a759f92efaac, 2017-05-09 (annotated)
- Committer:
- chris1996
- Date:
- Tue May 09 19:35:27 2017 +0000
- Revision:
- 6:a759f92efaac
Test these drivers ok ok
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris1996 | 6:a759f92efaac | 1 | #include "motordriver.h" |
chris1996 | 6:a759f92efaac | 2 | #include "motordriver.cpp" |
chris1996 | 6:a759f92efaac | 3 | |
chris1996 | 6:a759f92efaac | 4 | Motor A(D6, D5, D4, 1); // pwm, fwd, rev, can break |
chris1996 | 6:a759f92efaac | 5 | Motor B(D3, D7, D2, 1); // pwm, fwd, rev, can break |
chris1996 | 6:a759f92efaac | 6 | int main() { |
chris1996 | 6:a759f92efaac | 7 | for (float s=-1.0; s < 1.0 ; s += 0.01) { |
chris1996 | 6:a759f92efaac | 8 | A.speed(s); |
chris1996 | 6:a759f92efaac | 9 | B.speed(s); |
chris1996 | 6:a759f92efaac | 10 | wait(0.02); |
chris1996 | 6:a759f92efaac | 11 | } |
chris1996 | 6:a759f92efaac | 12 | A.stop(); |
chris1996 | 6:a759f92efaac | 13 | B.stop(); |
chris1996 | 6:a759f92efaac | 14 | wait(1); |
chris1996 | 6:a759f92efaac | 15 | A.coast(); |
chris1996 | 6:a759f92efaac | 16 | B.coast(); |
chris1996 | 6:a759f92efaac | 17 | } |