Machine.machineOn()

[Motion86]

描述

Switch the Machine object to MachineOn mode.

You must enter MachineOn mode before you can use any motion control-related methods. You cannot configure config-related methods after you enter MachineOn mode.

語法

machine.machineOn();

參數

machine: Machine object.

No Parameter.

回傳

No return.

範例

Set the basic parameters of the machine, move after MachineOn, and then configure the configuration again after MachineOff.

#include "Motion86.h"
 
// Produce machine parts, up to machine 0~2 three machines, three axes per machine. 
Machine machine(0);
 
// 步進馬達 enable pin。
int EnablePin = 4;
 
void setup() {
  while (!Serial);
  pinMode(EnablePin, OUTPUT);
 
 
  // 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, 3200.0);
   
  // Before control, the machine must be started.
  machine.machineOn();
  machine.setDefaultFeedrate(400);
   
  // Start the stepper motor.
  digitalWrite(EnablePin, LOW);
   
  machine.line(10, 10, 0);
   
  // We should turn off the machine before config it.
  machine.machineOff();
   
  // 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);
 
  // Before control, the machine must be started.
  machine.machineOn();
   
  machine.line(20, 20, 0);
}
 
void loop() {
 
}

參考


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール