I want to find...

Search

Shares

Table of Content

AIServo.setOffset()

[AIServo86]

Description

Set the offset angle of the servo.

This function can be used to fine-tune the angle of the servo after initialization. Once the offset value is set, the library will automatically add the offset value to calculate the actual target angle when calculating the target angle of the servo in the future.

Syntax

servo.setOffset(value)

Parameters

  • servo: the variable of AIServo type.
  • value: the offset in floating point, unit: degree.

Returns

None.

Example

#include <AIServo86.h>
  
AIServoPort(ROBOTIS, AX12) bus;
AIServo myservo;
  
void setup()
{
   bus.begin(Serial1, 1000000);
   myservo. attach(bus, 9);
   myservo.setOffset(-5); // Set the trim angle of -5 degrees
   myservo.write(150); // turn the servo to 150 degrees (actually 150 - 5 = 145)
}
  
void loop() {}

See also


Libraries 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.

Leave a Comment

Scroll to Top