By using USB cable, I was able to connect an XL-320 to Ardunio IDE (running on Ubuntu) through Open CM 9.0.4. I was also able to run the attached sketch (xl-deneme.ino).
However, when I tried to run the sketch for AX12 (I did modify relevant parts of the code like control table references etc.) it did not work. I used Open CM Expansion Board on top of Open CM for connecting AX12 to Ardunio IDE. I can`t get the connection established. (I get "There is no status packet" error)
I attach the sketch for XL-320 and also the sketch for AX-12 (ax-deneme.ino). Could you please try my sketches and check where the problem is??
PS: In my sketch for ax12, I tried DEVICENAME to be "3" and also tried "/dev/ttyACM0". But neither worked. Which one should I normally use? What is the difference between using the DEVICENAME (i.e. port) as 1,2,3, or /dev/ttyACM0?
Thanks in advance!
In order to use Dynamixel connected to 485 EXP board, you should use DEVICENAME "3" which is correct in your source code.
AX series use 2 byte Goal Position and Present Position data, therefore, you need to use the following read/write functions.
// Write goal position
dxl_comm_result = packetHandler->write2ByteTxRx(portHandler, DXL_ID, ADDR_PRO_GOAL_POSITION, dxl_goal_position[index], &dxl_error);
// Read present position
dxl_comm_result = packetHandler->read2ByteTxRx(portHandler, DXL_ID, ADDR_PRO_PRESENT_POSITION, (uint16_t*)&dxl_present_position, &dxl_error);