Control the rotation Speed of an AX12 servo (Continuous rotation mode). This program is based on the AX12 API developped by Chris Styles.
Fork of AX12-HelloWorld by
main.cpp@1:b12b06e2fc2d, 2011-03-31 (annotated)
- Committer:
- chris
- Date:
- Thu Mar 31 12:03:04 2011 +0000
- Revision:
- 1:b12b06e2fc2d
- Parent:
- 0:f6f8cf11779f
- Child:
- 2:c3ff024924df
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:f6f8cf11779f | 1 | #include "mbed.h" |
chris | 0:f6f8cf11779f | 2 | #include "AX12.h" |
chris | 0:f6f8cf11779f | 3 | |
chris | 0:f6f8cf11779f | 4 | int main() { |
chris | 0:f6f8cf11779f | 5 | |
chris | 0:f6f8cf11779f | 6 | AX12 myax12 (p9, p10, 1); |
chris | 1:b12b06e2fc2d | 7 | |
chris | 0:f6f8cf11779f | 8 | while (1) { |
chris | 1:b12b06e2fc2d | 9 | myax12.SetGoal(0); // go to 0 degrees |
chris | 0:f6f8cf11779f | 10 | wait (2.0); |
chris | 1:b12b06e2fc2d | 11 | myax12.SetGoal(300); // go to 300 degrees |
chris | 0:f6f8cf11779f | 12 | wait (2.0); |
chris | 0:f6f8cf11779f | 13 | } |
chris | 0:f6f8cf11779f | 14 | } |