Servo86.setOffset()

[Servo86]

説明

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

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

コメントする

上部へスクロール