setOffsets()

描述

offsets[] 陣列值設定至對應的伺服機。

語法


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

參數

servooffsetAIServoOffset 型別的變數。

servo1 ~ servo64AIServo 型別的變數。

回傳

範例

#include <AIServo86.h> 

AIServoPort(ROBOTIS, AX12) bus;
AIServo  myservo0;
AIServo  myservo1;
AIServo  myservo2;
AIServoOffset myoffset;

void setup() 
{ 
  bus.begin(Serial1, 1000000);
  myservo0.attach(bus, 9);
  myservo1.attach(bus, 11);
  myservo2.attach(bus, 5);
  myoffset.offsets[0] = -20; // 設定 Offset 內容
  myoffset.offsets[1] = 5;
  myoffset.offsets[2] = -10;
  // 將 Offset 的值指定到伺服機  (offsets[0] 的值指定到 myservo0 
  // ,offsets[1] 的值指定到 myservo1,offsets[2] 的值指定到 myservo2)
  myoffset.setOffsets(myservo0, myservo1, myservo2);
} 

void loop() {} 

See also

offsets[]


函式庫參考主頁面

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.