Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 2.26 KB

LibraryDoc.md

File metadata and controls

69 lines (50 loc) · 2.26 KB

This is the documentation file for of the library

In this file is described how to use the library and all its functions.

Setup the library

To import the library:

#include <Step_er.h>

Initialize the Step_er class:

Step_er mystepper(_mode_);

The mode has to be choosed between STEP_DRIVE, FULL_STEP, HALF_STEP (read more in the motor doc Stepping mode).

Initialize the stepper motor:

void setup() {
  
  mystepper.attach(_IN1, _IN2, _IN3, _IN4);

}

_IN1, _IN2, _IN3, _IN4 are the pin where the ULN2003 driver is atthacched to.

Library Functions

There are different function to turn the motor:

In all function _direction is a boolean, and is referred to the direction of the movement True=clockwise or False=anticlockwise.

  • Turn by steps:

    mystepper.step_move(_steps, _direction);

    _steps is an int, and is referred to the number of steps to move by;

  • Turn by angle:

    mystepper.ang_move(_angle, _direction);

    _angle is a float, and is referred to the angle to move by;

  • Turn by revolutions:

    mystepper.turn(_revolution, _direction);

    _revolutions is an int, and is referred to the number of revolutions (full turn of 360°) to move by;

  • Turn by a single step:

    mystepper.one(_direction);

    This function allow to move by a single step without calling the .step_move method.

Special Functions

This library contain also other special function.

  • Reset Until Button is Pressed:
    mystepper.resetTo(_ButtonPin, _direction);
    _ButtonPin is an int, and is referred to the pin where the button is attached. this function is mentioned in an example of the library ResetToButton and the schematic can be found in the images folder of the library or in the ReadMe.

Read the documentation of the motor at []