[Motion86]
説明
The home point is used as the base, and absolute coordinates are used to plan the movement.
構文
machine.setAbsolute();
Paramteters
machine: Machine object.
戻り値
なし
例
Use the absolute coordinates to draw the square.
#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, you can reverse the motion direction of the motion axis.
machine.config_ReverseDirection(AXIS_X);
machine.config_ReverseDirection(AXIS_Y);
// PPU (pulse per unit) is a virtual length unit, depending on the requirements.
// In this example, the machine sets the unit length of x-axis 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();
// Set the default feed rate.
machine.setDefaultFeedrate(600);
// Start the stepper motor.
digitalWrite(EnablePin, LOW);
// Use home point as the base, use absolute coordinates to plan the movement.
// If home point is not set separately, then home point is the position at which the machine is turned on.
machine.setAbsolute();
// Use absolute coordinate value to move to the center position.
machine.line(170,100,10,400);
machine.line(170,100,10,800);
machine.line(170,100,0,400);
}
void loop() {
// Move to the absolute position, where no feed rate is set to represent the default value.
machine.line(170,100,0);
machine.line(180,100,0);
machine.line(180,110,0);
machine.line(170,110,0);
// Wait until the planned movement is completed.
while (machine.isMoving());
}参照
ライブラリリファレンスホーム
86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。