offsets[]

Description

Stores user-defined robot offsets. Each servo offset ranges from -256 to 256, in units of us. This array stores all servo offsets, which can be user-defined. The first element in the array represents the servo offset for the first channel, the second element represents the servo offset for the second channel, and so on. You can call attach() to specify the 86Duino pin that offsets[] corresponds to (see the example below).

Syntax

servooffsetvstone.offsets[channel]

Parameters

servooffsetvstone: Variable of type ServoOffsetVstone. channel: Range: 0 to 44; its value represents the Servo on channel n. If you use load() to read the Vstone Offset file, the number of channels will be fixed at 30. The offset values of the 0th to 29th channel groups are stored in offsets[0], offsets[1] … offsets[23] respectively. The content of offsets[] after the 29th group is 0.

Postback

None

Example

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

#include <Servo86.h>

 

Servo  myservo0;

Servo  myservo1;

Servo  myservo2;

ServoOffsetVstone myoffset;

 

void setup()

{

  myservo0.attach(9); myservo1.attach(11); myservo2.attach(5);

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

  myoffset.offsets[1] = 50;

  myoffset.offsets[2] = -100;

  // Assign the Offset value to the servo (offsets[0] The value of offsets[1] is assigned to myservo0,

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

  myoffset.setOffsets(myservo0, myservo1, myservo2);

}

 

void loop() {}

See also

setOffsets()


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.