How to control multi AX-12A servo motors by using Dynamixel shield

I can see that you were trying to use the sketch position_mode.ino to start from, and that was a good step. However, because ROBOTIS produces so many types of actuators, you should ALWAYS check the specific CONTROL TABLE of your specific DXL before applying the provided example sketches.

So if you go to this web link for the AX-12

You are going to find out that the parameter PROFILE_VELOCITY does not exist for the AX-12. PROFILE_VELOCITY only applies for the newer X-series, while the AX-12 uses the MOVING_SPEED parameter, so you need to use the following statements to set up the “Speed” of your AX-12s when they are in Position Control mode.

dxl.writeControlTableItem(MOVING_SPEED, DXL_ID, 512); // range 0-1023
dxl.writeControlTableItem(MOVING_SPEED, DXL_ID2, 512); // range 0-1023

More details for MOVING_SPEED are available here

The lesson to remember is that if you want to use writeControlTableItem(), you better check with the ACTUAL Control Table for your specific actuator.

Fortunately, all the set and get types of functions are applicable to ALL Dynamixels.