Arduino_EMBRYO_2 - toStep()

Moves the robot carriage to a specified step count. Zero is in the motor home position and max number of steps is in the axis end far from the motor home.

Syntax

axis.toStep(step)

Parameters

  • step: position in step counts with home equals to zero

Example

#include <Arduino_EMBRYO_2.h>

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

void setup() {
  Serial.begin(9600);
  while (!Serial) {};
  axis.begin();
  Serial.println("Press the Start Button to start the machine");
  while(!axis.ready()); // Wait for Start button to be pressed
  Serial.println("Current step: " + String(axis.getStep()));
  delay(1000);
  axis.toStep(1000);
  Serial.println("Current step: " + String(axis.getStep()));
}
void loop() {}

See also