Stepper \ Libraries \ Wiring 1.0 (ALPHA)

| Index

| Reference for Wiring 1.0 (ALPHA) 0017+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name |  | ### Stepper
Examples |  |
    #include <Stepper.h>

    // change the steps variable to the number of steps on your motor
    int steps = 100;

    // create and attaches a stepper motor
    // with 100 steps to pins 0, 1, 2 and 3

    Stepper stepper(steps, 0, 1, 2, 3);

    void setup()
    {
      // set the speed of the motor to 20 rpms
      stepper.setSpeed(20);
    }

    void loop()
    {
      // move 20 steps forward
      stepper.step(20);

      // move 20 steps backwards
      stepper.step(-20);
    }
Description |  | Class for controlling stepper motors connected to the Wiring I/O pins. The number of pins used depends on how the motor is wired to the Wiring I/O board.
Syntax |  |
    Stepper mystepper(steps, pin1, pin2);
    Stepper mystepper(steps, pin1, pin2, pin3, pin4);
Parameters |  |
steps |  | The number of steps in one revolution of the motor
pin1, pin2, pin 3, pin 4 |  | The pin numbers connected to the motor
Methods |  |
setSpeed() |  |
step() |  |
Returns |  | None
Usage |  | Application