A library for the AX-12+ servo using external ICs instead of the SerialHalf-Duplex class
AX12 Class Reference
mbed AX-12+ Servo Library - External hardware version More...
#include <AX12.h>
Public Member Functions | |
AX12 (Serial &bus, PinName dir, int ID) | |
define which pins are used, and the ID of this instance | |
int | read (int ID, int start, int length, char *data) |
Read info from the specified AX-12 register. | |
int | write (int ID, int start, int length, char *data) |
Write info to the specified AX-12 register. | |
int | SetGoal (int degrees) |
Sets the goal position for the servo. | |
float | GetPosition () |
Getss the current position for the servo. |
Detailed Description
mbed AX-12+ Servo Library - External hardware version
Example:
// Move a servo back and forth... #include "mbed.h" #include "Servo.h" Serial ax12_bus(p28,p27); AX12 my_ax12(ax12_bus, p29, 1); int main() { while(1) { my_ax12.SetGoal(0); // move to 0 wait(2); my_ax12.SetGoal(300); // move to 300 wait(2); } }
Definition at line 58 of file AX12.h.
Constructor & Destructor Documentation
AX12 | ( | Serial & | bus, |
PinName | dir, | ||
int | ID | ||
) |
Member Function Documentation
float GetPosition | ( | void | ) |
int read | ( | int | ID, |
int | start, | ||
int | length, | ||
char * | data | ||
) |
int SetGoal | ( | int | degrees ) |
int write | ( | int | ID, |
int | start, | ||
int | length, | ||
char * | data | ||
) |
Generated on Fri Jul 15 2022 12:14:15 by 1.7.2