This function reads data from specific memory addresses of DYNAMIXEL with a specific ID.
addr
. Data type : unsigned int16p_recv_buf
buffer. Data type : unsigned int16Length of received parameters
on success.-1
on failure.#define ID_ADDR 7
#define ID_ADDR_LEN 1
#define TIMEOUT 10 //default communication timeout 10ms
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
const uint8_t DXL_ID = 1;
const float DXL_PROTOCOL_VERSION = 2.0;
uint8_t returned_id = 0;
Dynamixel2Arduino dxl(DXL_SERIAL, DXL_DIR_PIN);
void setup() {
DEBUG_SERIAL.begin(115200);
dxl.begin(57600);
dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);
// Read DYNAMIXEL ID
dxl.read(DXL_ID, ID_ADDR, ID_ADDR_LEN, (uint8_t*)&returned_id, sizeof(returned_id), TIMEOUT);
DEBUG_SERIAL.print("ID : ");
DEBUG_SERIAL.println(returned_id);
}
void loop() {
// put your main code here, to run repeatedly:
}