
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@0:f6f8cf11779f, 2010-06-03 (annotated)
- Committer:
- chris
- Date:
- Thu Jun 03 14:25:20 2010 +0000
- Revision:
- 0:f6f8cf11779f
- Child:
- 1:b12b06e2fc2d
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 | 0:f6f8cf11779f | 7 | |
chris | 0:f6f8cf11779f | 8 | while (1) { |
chris | 0:f6f8cf11779f | 9 | myax12.SetGoal(60); // go to 60 degrees |
chris | 0:f6f8cf11779f | 10 | wait (2.0); |
chris | 0:f6f8cf11779f | 11 | myax12.SetGoal(240); // go to 240 degrees |
chris | 0:f6f8cf11779f | 12 | wait (2.0); |
chris | 0:f6f8cf11779f | 13 | } |
chris | 0:f6f8cf11779f | 14 | } |