[Motion86]
説明
Enter a G-Code to control the Machine.
Motion86 supports the following G-Codes:
Please refer to the G-Code reference table.
| G-Code | 説明 |
| G1 | Linear motion |
| G2 | Clockwise circular motion |
| G3 | Counterclockwise circular motion |
| G4 | Pause command |
| G17 | Select XY plane for circular motion |
| G18 | Select XZ plane for circular motion |
| G19 | Select YZ plane for circular motion |
| G90 | Absolute position mode |
| G91 | Relative position mode |
| G90.1 | Absolute position mode at the center of the arc |
| G91.1 | Arc center relative position mode |
| G92 | Coordinate System Offset |
構文
machine.gcode(cmd);
媒介変数
machine: Machine object.cmd: The G-Code string to be sent.
戻り値
bool:
- true: The machine exists and was created successfully.
- false: The machine does not exist or failed to create.
例
#include "Motion86.h"
// Produce machine parts, up to machine 0~2 three machines, three axes per machine.
Machine machine(0);
// Stepper motor enable pin.
int EnablePin = 4;
void setup() {
while (!Serial);
pinMode(EnablePin, OUTPUT);
// If necessary, the direction of motion of the motion axis can be reversed.
// In this example, it is necessary to reverse the direction of the x-axis and y-axis.
machine.config-ReverseDirection(AXIS-X);
machine.config-ReverseDirection(AXIS-Y);
// PPU (pulse per unit) is a virtual length unit, depending on the requirements.
// The unit length of the x-axis is set to 80 pulses, which corresponds to 1 mm for actual application.
machine.config-PPU(AXIS-X, 80.0);
machine.config-PPU(AXIS-Y, 80.0);
machine.config-PPU(AXIS-Z, 1600.0);
// Before control, the machine must be started.
machine.machineOn();
// Start the stepper motor.
digitalWrite(EnablePin, LOW);
}
void loop() {
// Move left to (-10, 0).
machine.gcode("G1 X-10 Y0 F400");
// Move 90 degrees clockwise by radius 10 to (0, 10).
machine.gcode("G2 X0 Y10 R10 F400");
// Move down to (0, -10).
machine.gcode("G1 X0 Y-10 F400");
// Move 90 degrees counterclockwise at radius 10 to (10, 0).
machine.gcode("G3 X10 Y0 R10 F400");
// Move left to (0, 0).
machine.gcode("G1 X0 Y0 F400");
// Wait until the planned campaign is completed.
while (machine.isMoving());
}ライブラリリファレンスホーム
86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。