AIServoPort constructor

Description

Initializes the AIServoPort class.

Syntax

AIServoPort(Vendor, Servo) bus

Parameters

Vendor: The vendor of the servo to be connected to this bus. For example: ROBOTIS.

Servo: The model of the servo to be connected to this bus. For example: AX12, RX28, MX28, XL320.

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

begin()


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.