begin()

Description

Sets and enables the AIServoPort.

Syntax

bus.begin(HardwareSerial, Baudrate)

Parameters

bus: A variable of type AIServoPort.

HardwareSerial: The port to communicate with the servo. For example: Serial1, Serial485.

Baudrate: The baud rate used for communication. For example: 115200, 1000000.

Example

1

2

3

4

5

6

7

8

9

10

11

12

13

#include <AIServo86.h>

 

AIServoPort(ROBOTIS, AX12) bus; // Initialize the bus to control the ROBOTIS AX-12 servo

AIServo myservo; // Initialize myservo

 

void setup()

{

  bus.begin(Serial1, 1000000); // Set the bus to use serial port 1 and a baud rate of 1000000

  myservo.attach(bus, 9); // Mount myservo to the bus, and myservo's ID is 9

  myservo.write(150); // Start the servo and rotate it to 150 degrees

}

 

void loop() {}

See also

AIServoPort


Library Reference Home

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.