[Motion86]
Description
Returns the Machine to the home point.
If config_HomePins is configured, the machine moves in the negative direction of x, y, and z axes until it touches the limit switch and sets that position as the home point.
If config_HomePins is not configured, the machine will take the current position as home point.
Syntax
machine.home();
Parameters
Machine: Machine object.
No parameter.
Returns
None.
Example
Set the basic parameters of the machine and move the machine to the Home point.
#include "Motion86.h"
// Produce machine parts for up to machine 0~2 three machines, each machine with three axes.
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.
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);
// Set the software limits for the machine movement.
machine.config_PosLimit(AXIS_X, 0, 300);
machine.config_PosLimit(AXIS_Y, 0, 200);
machine.config_PosLimit(AXIS_Z, 0, 300);
// Set the pin used to set the limit switch for the home point.
machine.config_HomePins(2, 7, 8);
// Before control, the machine must be started.
machine.machineOn();
// Set the default feed rate.
machine.setDefaultFeedrate(400);
// Start the software limits.
machine.enableSoftLimit();
// Set the feed rate to return to the home point.
machine.setHomeSpeed(1000, 1000, 200);
// Start the stepper motor.
digitalWrite(EnablePin, LOW);
// Return to the home point defined by the limit switch.
machine.home();
}
void loop() {
// Motion control code...
}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.