save()

Description

Saves the offsets of all AIServos on the robot (i.e., the offsets[] array) to the specified file.

Syntax

servooffset.save(filename)

Parameters

servooffset: A variable of type AIServoOffset. filename: The name of the file. Please note that files currently only support saving to the root directory of an SD card. If your 86Duino does not have an SD card, saving will fail.

Return

true: File saving succeeded.

false: File saving failed.

Example

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

#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 fine-tuning value to "offset0.txt" in the root directory of the SD card

}

 

void loop() {}

See also

- offsets[]
- setOffsets()
- load()


Library Reference Page

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.