Arduino_EMBRYO_2 - toPositionXY()

Moves the robot carriages to a specified XY position in centimeters along the axis. Zero is the motor home position and max position is in the axis end far from the motor home and is equal to the length of each axis.

Syntax

robot.toPositionXY(positionX, positionY)

Parameters

  • positionX: X-axis position in centimeters with home equals to zero
  • positionY: Y-axis position in centimeters with home equals to zero

Example

#include <Arduino_EMBRYO_2.h>

StepMotor axisX(1, A5, 5, 6, 3, 4, A1, A2, 2, 12);

StepMotor axisY(2, A5, 10, 11, 8, 9, A3, A4, 2, 12);

Embryo robot(axisX, axisY, 2, 12);

unsigned int positionX = 0, positionY = 0;

void setup() {
  Serial.begin(115200);
  while (!Serial) {};

  robot.begin();

  Serial.println("Press the Start Button to start the machine");
  while(!robot.ready());
}
void loop() {
  Serial.println("Enter the number of the position for X-axis: ");
  while((Serial.available() <= 0)){};
  positionX = Serial.parseInt(); 

  
  Serial.println("Enter the number of the position for Y-axis: ");
  while((Serial.available() <= 0)){};
  positionY = Serial.parseInt(); 

  robot.toPositionXY(positionX, positionY); 
}

See also