arcXZ()

Description

Use clockwise or counterclockwise arcs. The direction is from the positive direction of the Y axis where the circular motion occurs.
This method uses two different ways to control the arc path according to the different input parameters:
1. Center mode – that is, the arc path is calculated by giving the center and end point positions.
2. Radius mode – that is, the arc path is calculated by giving the radius and end point positions.
※ Note that no matter which arc motion method is used, the target may not be on the circle due to incorrect parameter settings, which will cause the machine to move unexpectedly.
If you want to learn about various exercise methods, please refer to the Exercise Method Explanation page.

Grammar

machine.arcXZ(r, dstX, dstZ);
machine.arcXZ(r, dstX, dstZ, revDir);
machine.arcXZ(r, dstX, dstZ, revDir, feedrate);
machine.arcXZ(cX, cZ, dstX, dstZ);
machine.arcXZ(cX, cZ, dstX, dstZ, revDir);
machine.arcXZ(cX, cZ, dstX, dstZ, revDir, feedrate);

Parameters

machine: is a Machine object.

r: Arc radius in radius mode.

cX: Center X coordinate in center mode.

cZ: Center Z coordinate in center mode.

dstX: Target X coordinate.

dstZ: Target Z coordinate.

revDir: Reverse direction, use true for counterclockwise, false for clockwise, default is clockwise.

feedrate: Feedrate, if no parameter is passed, the last recorded feedrate will be used.

Returns

bool:

true: The machine exists and is created successfully.
false: The machine does not exist or fails to be created.

Example

Set the basic parameters of the machine and make the machine move in two modes on the XZ plane.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

#include "Motion86.h"

 

// Generate machine objects. You can use up to three machines, machine 0~2, each 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 axis can be reversed.

  // In this example, you need to reverse the direction of the x-axis and the y-axis.

  machine.config_ReverseDirection(AXIS_X);

  machine.config_ReverseDirection(AXIS_Y);

 

  // PPU (pulse per unit) is a virtual unit of length, depending on different needs.

  // In this example, the unit length of the x-axis is set to 80 pulses, which corresponds to 1 mm in actual application.

  machine.config_PPU(AXIS_X, 80.0);

  machine.config_PPU(AXIS_Y, 80.0);

  machine.config_PPU(AXIS_Z, 1600.0);

 

  // Before controlling, the machine must be started.

  machine.machineOn();

  machine.setDefaultFeedrate(400);

 

  // Start the stepper motor.

  digitalWrite(EnablePin, LOW);

}

 

void loop() {

  // Move clockwise to (10, 0, 10) with a radius of 10.

  machine.arcXZ(10, 10, 10, true);

 

  // Move counterclockwise to (0, 0, 0) with a radius of 10.

  machine.arcXZ(10, 0, 0, false);

 

  // Move clockwise from the center of the circle (0, 0, 10) to (10, 0, 10).

  machine.arcXZ(0, 10, 10, 10, true);

 

  // Move counterclockwise from the center of the circle (0, 0, 10) to (0, 0, 0).

  machine.arcXZ(0, 10, 0, 0, false);

   

  // Wait until the planned movement is completed.

  while (machine.isMoving());

}

See also

arcXY()
arcYZ()
arcXY_Theta()
arcYZ_Theta()
arcXZ_Theta()


Function library reference

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