Servo86.setOffset()

[Servo86]

Description

Set the servo’s center position offset.

Some models of RC servo may have a slight error in the center position of each other due to the difference in production. This function can be used to compensate for the servo’s center position error. Once the center position offset is set by this function, the library will automatically add the offset to calculate the actual target angle when calculating the servo’s target angle in the future.

Syntax

servo.setOffset(value)

Parameters

  • servo: Variable of the servo type.
  • value: bias port, range: -256~256, unit: us.

Returns

None.

Example

#include <Servo86.h>
  
Servo myservo;
  
void setup()
{
   myservo.attach(9);
   myservo.setOffset(-10); // set the fine-tuning angle of -10 us
   myservo.write(1500); // turn the servo to 1500us angle (actually 1500 - 10 = 1490us)
}
  
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