AIServoOffset.load()

[AIServo86]

描述

Loads the robot’s AIServos offset from the specified file (i.e., reads the AIServo offset from the file and loads it into the offsets[] array).

語法

servooffset.load(filename)

參數

servooffset: variable of type AIServoOffset.

filename: the name of the file. Please note that currently only the root directory of the SD card is supported for downloading files. If your 86Duino does not have an SD card on it, or if the SD card does not contain the specified files, loading will fail.

回傳

  • true: File loading successfully.
  • false: File loading failed.

範例

#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.load("offset0.txt"); // Load the robot motion trim value from the specified file
   myoffset.setOffsets(myservo0, myservo1, myservo2); // Set the fine-tuning value of the robot motion
}
 
void loop() {}

參考


函式庫參考主頁面

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

發表評論

上部へスクロール