Machine.helicalXZ()

[Motion86]

説明

Use clockwise arc or counterclockwise to draw the spiral. The direction is viewed from the positive direction of the Y-axis where the circular motion occurs.

This method uses the circle center pattern to control the helix path and uses the positive and negative values of the rotation angle to select clockwise or counterclockwise.

For more information on the various motion methods, please see the Motion Methods explanation page.

Syntax

machine.helicalXZ(cX, cZ, dstY, theta);
machine.helicalXZ(cX, cZ, dstY, theta, feedrate);

Parameters

  • machine: Machine object.
  • cX: The center X coordinate of the circle in center mode.
  • cZ: The center Z coordinate of the circle in circle mode.
  • dstY: The target Y coordinate, i.e., the axis is moved to the target coordinate together with the arc motion.
  • theta: the angle to be rotated, use positive value when clockwise, use negative value when counterclockwise.
  • feedrate: The feedrate of the last recorded feedrate will be used when the parameter is not passed.

Returns

bool.

  • true: The machine exists and was created successfully.
  • false: The machine does not exist or failed to be created.

Example

Set the basic parameters of the machine and helix the machine in the XZ plane.

#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 two circles clockwise from the center (0, 0, 10) to (0, 10, 0).
  machine.helicalXZ(0, 10, 10, TWO_PI * 2, true);
 
  // Move two circles counterclockwise by the center (0, 10, 10) to (0, 0, 0).
  machine.helicalXZ(0, 10, 0, TWO_PI * 2, false);
 
  // Wait until the planned motion is completed.
  while (machine.isMoving());
}

See also


Libraries Reference Home

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

コメントする

上部へスクロール