ServoOffset.setOffsets()

[Servo86]

描述

Set the offsets[] array value to the corresponding servo.

語法

servooffset.setOffsets()
servooffset.setOffsets(servo1)
servooffset.setOffsets(servo1, servo2)
servooffset.setOffsets(servo1, servo2, ... , servo45)

參數

  • servooffset: The variable of ServoOffset type.
  • servo1 ~ servo45: The variables of Servo type.

回傳

範例

#include <Servo86.h>
 
Servo myservo0;
Servo myservo1;
Servo myservo2;
ServoOffset myoffset;
 
void setup()
{
   myservo0.attach(9); myservo1.attach(11); myservo2.attach(5);
   myoffset.offsets[0] = -200; // set Offset content
   myoffset.offsets[1] = 50;
   myoffset.offsets[2] = -100;
   // assign the Offset value to the servo (offsets[0] assigns the value to myservo0
   // , the value of offsets[1] is assigned to myservo1, and the value of offsets[2] is assigned to myservo2)
   myoffset.setOffsets(myservo0, myservo1, myservo2);
}
 
void loop() {}

參考


函式庫參考主頁面

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

發表評論

上部へスクロール