Initial Commit
motors.cpp@0:5b2bf6e79b07, 2014-05-08 (annotated)
- Committer:
- Throwbot
- Date:
- Thu May 08 19:11:31 2014 +0000
- Revision:
- 0:5b2bf6e79b07
- Child:
- 1:201d986498c7
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Throwbot | 0:5b2bf6e79b07 | 1 | #include "motors.h" |
Throwbot | 0:5b2bf6e79b07 | 2 | |
Throwbot | 0:5b2bf6e79b07 | 3 | Motors::Motors(TB6612 * L, TB6612 * R, PinName STBY): |
Throwbot | 0:5b2bf6e79b07 | 4 | Left(L), Right(R), enable(STBY) |
Throwbot | 0:5b2bf6e79b07 | 5 | { |
Throwbot | 0:5b2bf6e79b07 | 6 | enable = 1; |
Throwbot | 0:5b2bf6e79b07 | 7 | } |
Throwbot | 0:5b2bf6e79b07 | 8 | |
Throwbot | 0:5b2bf6e79b07 | 9 | void Motors::flip() |
Throwbot | 0:5b2bf6e79b07 | 10 | { |
Throwbot | 0:5b2bf6e79b07 | 11 | TB6612 * temp = Left; |
Throwbot | 0:5b2bf6e79b07 | 12 | Left = Right; |
Throwbot | 0:5b2bf6e79b07 | 13 | Right = temp; |
Throwbot | 0:5b2bf6e79b07 | 14 | |
Throwbot | 0:5b2bf6e79b07 | 15 | Left->scale *= -1; |
Throwbot | 0:5b2bf6e79b07 | 16 | Right->scale *= -1; |
Throwbot | 0:5b2bf6e79b07 | 17 | } |