[Motion86]
描述
A full circle is drawn using either a clockwise arc or counterclockwise. The direction is viewed from the positive direction of the X-axis where the circular motion occurs.
This method uses the center-of-circle mode to control the path of the arc, and because it is a complete circular motion, the target position will return to the starting position.
For more information about the various motion methods, please see the Motion Methods explanation page.
語法
machine.circleYZ(cY, cZ);
machine.circleYZ(cY, cZ, revDir);
machine.circleYZ(cY, cZ, revDir, feedrate);
參數
machine: Machine object.cY: The center Y coordinate of the circle in center mode.cZ: the center Z coordinate of the circle in circle mode.revDir: reversing direction, use true when counterclockwise, use false when clockwise, default is clockwise.feedrate: Feedrate, the last recorded feedrate will be used when no parameter is passed.
回傳
bool.
- true: The machine exists and was created successfully.
- false: The machine does not exist or failed to be created.
範例
Set the basic parameters of the machine and round the machine in the YZ plane.
#include "Motion86.h"
// Generate machine objects, up to machine 0~2 three machines, each machine has three axes.
Machine machine(0);
// Stepper motor enable pin.
int EnablePin = 4;
void setup() {
while (!Serial);
pinMode(EnablePin, OUTPUT);
// If necessary, the motion direction of the motion axis can be reversed.
// In this example, the direction of x-axis and y-axis should be reversed.
machine.config_ReverseDirection(AXIS_X);
machine.config_ReverseDirection(AXIS_Y);
// PPU (pulse per unit) is a virtual length unit, depending on different requirements.
// In this example, the unit length of x-axis is set to 80 pulses, which corresponds to 1 mm in real application.
machine.config_PPU(AXIS_X, 80.0);
machine.config_PPU(AXIS_Y, 80.0);
machine.config_PPU(AXIS_Z, 1600.0);
// The machine must be started before control.
machine.machineOn();
machine.setDefaultFeedrate(400);
// Start the stepper motor.
digitalWrite(EnablePin, LOW);
}
void loop() {
// Move a circle clockwise with the center of the circle (0, 0, 10).
machine.circleYZ(0, 10, true);
// Move a circle counterclockwise with the center of the circle (0, 0, 10).
machine.circleYZ(0, 10, false);
// Wait until the planned movement is complete.
while (machine.isMoving());
}參考
函式庫參考主頁面
86Duino 參考的文本是根據 知識共享署名-相同方式分享 3.0 許可證,部分文本是從 Arduino 參考 修改的。 參考中的代碼示例已發佈到公共領域。