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.

語法

servo.setOffset(value)

參數

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

回傳

範例

#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() {}

參考


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール