Example Code for Arduino-Wireless Communication
Last revision 2026/01/30
In this section, we will use Arduino IDE to control the servo via wireless communication. Users can learn how to use wireless modules (e.g., Xbee, APC220) with the Veyron Servo Driver.
Hardware Preparation
- Veyron Servo Driver 24-Channel
- Micro USB cable
- TowerPro SG90 Servo
- Servo 5V power supply
- 9V power supply logic
- Wireless module (DFRobot Bluetooth module, APC220 wireless data transmission module or Xbee module)
Software Preparation
- Arduino IDE
- Windows Driver Download(required for first-time use)
Wiring Diagram
Xbee Wireless Communication

APC220 Wireless Communication

Other Preparation Work
- Veyron requires an external power supply to support the servo
Sample Code
void setup() {
Serial.begin(115200);//Set the baudrate to 115200 A:1 B:1
delay(100);//wait for baudrate setting finished
}
void loop() {
Serial.print("#5 P750");// Channel 5 will move to 750us within 500ms
delay(5); //wait for first comand transmission done, if you send
// a long command, you'd better extend it
Serial.print("\r"); // send Carriage Return <CR>
delay(1000); //wait for servo go to the set position
Serial.print("#5 P2200");// Channel 5 will move to 2200us within 500ms
delay(5);
Serial.print("\r");
delay(1000);
}
Was this article helpful?
