[Motion86]
描述
以指定進給速度(Feed Rate)進行直線插補運動,將機台移動至目標座標點。
有關更多運動控制方式,請參考 「運動控制方法說明」 頁面。
語法
machine.line(x, y, z);
machine.line(x, y, z, feedrate);
參數
machine:Machine 物件。X:目標 X 軸座標。y:目標 Y 軸座標。z:目標 Z 軸座標。feedrate:進給速度。若未指定,將使用前一次設定的進給速度。
回傳
bool。
- true:Machine 建立成功且存在。
- false:Machine 不存在或建立失敗。
範例
設定機器的基本參數,使機器沿直線來回移動至 (10, 10, 10)。
#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() {
// Linear motion to (10, 10, 10).
machine.line(10, 10, 10);
// Linear motion to (0, 0, 0).
machine.line(0, 0, 0);
// Wait until the planned motion is completed.
while (machine.isMoving());
}
Translated with www.DeepL.com/Translator (free version)函式庫參考主頁面
86Duino 參考的文本是根據 知識共享署名-相同方式分享 3.0 許可證,部分文本是從 Arduino 參考 修改的。 參考中的代碼示例已發佈到公共領域。