Motor control for robotic arm
Dependencies: MCP23017 WattBob_TextLCD mbed
Fork of Balanced Arm by
Diff: AX12.cpp
- Revision:
- 27:d032d8fd4b45
- Parent:
- 25:d345ef4cb2b5
--- a/AX12.cpp Mon Mar 07 18:53:33 2016 +0000 +++ b/AX12.cpp Thu Mar 10 14:39:28 2016 +0000 @@ -36,8 +36,8 @@ SetCCWLimit(0); SetCRSpeed(0.0); } else { - SetCWLimit(70); - SetCCWLimit(270); + SetCWLimit(0); + SetCCWLimit(300); SetCRSpeed(0.0); } return(0); @@ -141,6 +141,16 @@ return (angle); } +int AX12::GetVoltage(void){ + + char data[2]; + + int ErrorCode = read(_ID, AX12_REG_VOLTAGE, 2, data); + short volts = data[0] + (data[1] << 8); + + return (volts); +} + int AX12::read(int ID, int start, int bytes, char* data){ char TxBuf[16];