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.

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

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

コメントする

上部へスクロール