How to set Dynamixel servo ID using an Arduino ?

schematic diagram

Wiring Diagram

AX-12A  pin1: GND  --->  DC -12V
AX-12A  pin2: VDD  --->   DC +12V
AX-12A pin3: DATA --->  Tx pin of Arduino

*** Connect  the two grounds together ***

Ax-12A Library

Arduino Sketch

#include <AX12A.h>

/* Control pin of buffer chip,
 * NOTE: this does not matter becasue we are not using a half to full contorl buffer.
#define DirectionPin  (10u) // Control pin
#define BaudRate (1000000ul) // Default Baud rate
#define ID     (1u)

void setup() {
  // put your setup code here, to run once:
     delay(1000); // Give time for Dynamixel to start on power-up
     ax12a.begin(BaudRate, DirectionPin, &Serial);

     ax12a.setID(ID, 2 );

void loop() {
  // put your main code here, to run repeatedly: