AIServoOffset.save()

[AIServo86]

描述

Save the offsets (i.e., offsets[] array) of all AIServo’s on the robot to the specified file.

語法

servooffset.save(filename)

參數

servooffset: Variable of type AIServoOffset.

filename: the name of the file. Please note that the file is currently only supported to be saved to the root directory of the SD card. If you do not have an SD card on your 86Duino, saving will fail.

回傳

  • true: File was saved successfully.
  • false: File saving 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.offsets[0] = -20; // Set Offset content
   myoffset.offsets[1] = 5;
   myoffset.offsets[2] = -10;
   myoffset.save("offset0.txt"); // Save the motion fine-tuning value to "offset0.txt" in the root directory of SD card
}
 
void loop() {}

參考


函式庫參考主頁面

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

發表評論

上部へスクロール