Arduino_EMBRYO_2 - moveSteps()

Rotates the motor a specified number of steps. Positive step rotates the motor in clockwise direction and moves the robot carriage farther from motor home. Negative step rotates the motor in anticlockwise direction and moves the robot carriage closer to motor home.

Syntax

axis.moveSteps(numSteps)

Parameters

  • numSteps: number of the steps

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
}
void loop() {
  if(axis.readBtnForward()) axis.moveSteps(50);
  if(axis.readBtnBackward()) axis.moveSteps(-50);
}

See also