I want to find...

Search

Shares

Table of Content

ServoFrameVstone.positions[]

[Servo86]

Description

The value of each array element corresponds to the position of a robot servo in us.

If ServoFrameVstone is not specified to load the action frame file during initialization, users can set the action frame by setting the element value of this array directly.

Syntax

myframe.positions[channel]

Parameters

  • myframe: the object of ServoFrameVstone type.
  • channel: Specify the array element, the range is 0 ~ 44. The nth element value represents the position to be assigned to the nth Servo, please see the example below. (Note: All array elements are valid on 86Duino One; only the range 0 ~ 25 on 86Duino EduCake; only the range 0 ~ 16 on 86Duino Zero.)

Since RobovieMaker2 supports 30-axis servo, when loading the specified frames from its frame file using the load() function, only positions[0], positions[1], …, positions[29] will contain valid values, and all other array elements will be 0.

Returns

None.

Example

#include <Servo86.h>
  
Servo myservo0;
Servo myservo1;
Servo myservo2;
ServoFrameVstone myframe; // declare a ServoFrameVstone object
  
void setup()
{
   myservo0.attach(9);
   myservo1.attach(11);
   myservo2.attach(5);
 
   myframe.positions[0] = 1800; // set the frame content
   myframe.positions[1] = 1300;
   myframe.positions[2] = 2000;
 
   // Set the time to rotate the servo from the current position to the position specified by myframe in 500ms, that is:
   // myservo0 rotates to position[0],
   // myservo1 rotates to position[1],
   // myservo2 rotates to position[2].
   myframe.setPositions(500, myservo0 , myservo1, myservo2);
 
   servoMultiRun(); // command all servos to start turning
}
  
void loop() {}

See also


Libraries Reference Home

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.

Leave a Comment

Scroll to Top