Arduino_EMBRYO_2 - drawLine()

Draws a line with both axis of EMBRYO 2.

Syntax

robot.drawline(initialPositionX,
               initialPositionY,
               finalPositionX,
               finalPositionY)

Parameters

  • initialPositionX: line initial X-axis position.
  • initialPositionY: line initial Y-axis position.
  • finalPositionX: line final X-axis position.
  • finalPositionY: line final Y-axis position.

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);

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

  robot.begin();

  robot.setLengthXY(45, 38);
  
  Serial.println("Press the Start Button to start the machine");
  while(!robot.ready());
  
  Serial.println("Moving the robot to the initial XY position ...");
  
  robot.toPositionXY(5, 5);

  Serial.println("Press the forward button to continue ...");
}
void loop() {
  if(axisX.readBtnForward()){
    robot.drawLine(5,5,5,10);
  }
}

See also