I want to find...

Search

Shares

Table of Content

Machine.setAbsolute()

[Motion86]

Description

The home point is used as the base, and absolute coordinates are used to plan the movement.

Syntax

machine.setAbsolute();

Paramteters

machine: Machine object.

Returns

None.

Example

Use the absolute coordinates to draw the square.

#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, you can reverse the motion direction of the motion axis.
  machine.config_ReverseDirection(AXIS_X);
  machine.config_ReverseDirection(AXIS_Y);
  // PPU (pulse per unit) is a virtual length unit, depending on the requirements.
  // In this example, the machine sets the unit length of x-axis 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();
  // Set the default feed rate.
  machine.setDefaultFeedrate(600);
  // Start the stepper motor.
  digitalWrite(EnablePin, LOW);
  // Use home point as the base, use absolute coordinates to plan the movement.
  // If home point is not set separately, then home point is the position at which the machine is turned on.
   machine.setAbsolute();
  // Use absolute coordinate value to move to the center position.
  machine.line(170,100,10,400);
  machine.line(170,100,10,800);
  machine.line(170,100,0,400);
}
 
void loop() {
  // Move to the absolute position, where no feed rate is set to represent the default value.
  machine.line(170,100,0);
  machine.line(180,100,0);
  machine.line(180,110,0);
  machine.line(170,110,0);
    // Wait until the planned movement is completed.
  while (machine.isMoving());
}

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