offsets[]

Description

Stores user-defined robot offsets in degrees. This array stores the offsets of all AIServos. The values can be specified by the user. The first element in the array represents the offset of the first channel's servo, the second element represents the offset of the second channel's AIServo, and so on. Up to 64 channels of AIServo offsets can be specified.

Syntax

servooffset.offsets[channel]

Parameters

servooffset: A variable of type AIServoOffset. channel: Range: 0 ~ 63. Its value represents the AIServo of channel n. Please see the example below for an explanation.

Postback

None

Example

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

#include <AIServo86.h>

 

AIServoPort(ROBOTIS, AX12) bus;

AIServo  myservo0;

AIServo  myservo1;

AIServo  myservo2;

AIServoOffset myoffset;

 

void setup()

{

  bus.begin(Serial1, 1000000);

  myservo0.attach(bus, 9);

  myservo1.attach(bus, 11);

  myservo2.attach(bus, 5);

  myoffset.offsets[0] = -20; // Set the Offset value

  myoffset.offsets[1] = 5;

  myoffset.offsets[2] = -10;

  // Assign the Offset value to the servo (offsets[0] is assigned to myservo0

  // , offsets[1] is assigned to myservo1, offsets[2] is assigned to The value of is assigned to myservo2)

  myoffset.setOffsets(myservo0, myservo1, myservo2);

}

 

void loop() {}

See also

setOffsets()


 

Library Reference Home

The text in the 86Duino reference is adapted from the Arduino reference and is licensed under the Creative Commons Attribution-ShareAlike 3.0 License. The code examples in the reference have been released into the public domain.