Machine.stop()

[Motion86]

説明

Causes an emergency stop of the Machine and will clear all controls and planning.

Syntax

machine.stop();

Parameters

machine: Machine object.

No parameter.

Returns.

None.

Example

Set the basic parameters of the machine and put the machine into emergency stop after one second of movement.

#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() {
  // Move left to (-10, 0).
  machine.line(-10, 0, 0);
 
  // Move 90 degrees clockwise to (0, 10) with radius 10.
  machine.arcXY(10, 0, 10, true);
 
  // Move down to (0, -10).
  machine.line(0, -10, 0);
 
  // Move 90 degrees counterclockwise to (10, 0) with radius 10.
  machine.arcXY(10, 10, 0, false);
 
  // Move to the left to (0, 0).
  machine.line(0, 0, 0);
 
  // Motion will stop after 1 second.
  delay(1000);
  machine.stop();
}

See also


Libraries Reference Home

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

コメントする

上部へスクロール