I want to find...

Search

Shares

Table of Content

Machine.machineOff()

[Motion86]

Description

Switch the Machine object to MachineOff 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.

Syntax

machine.machineOff();

Parameters

machine: Machine object.

No parameter.

Returns

None.

Example

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);
 
// Stepper motor 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() {
 
}

See also


Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Leave a Comment

Scroll to Top