AIServo.setOffset()

[AIServo86]

描述

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.

語法

servo.setOffset(value)

參數

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

回傳

範例

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

參考


函式庫參考主頁面

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

發表評論

上部へスクロール