MTulnStepper: Example 1
Event management for Uno, Nano, Mega

Wiper

Wiper: this program uses a 28ByJ48 which goes back and forth continuously.

Complete program recommended

This program is completely under interruption, and releases loop which can be used to do something else.

// This program goes back and forth continuously for a stepper

#include <MTobjects.h> // V1.0.6 See http://arduino.dansetrad.fr/en/MTobjects

void inversion(void); // Pre-define

MTulnStepper Stepper(pin_A1 2, pin_B1 3, pin_A2 4, pin_B2 5, ONE_PHASE, accelerations_of 2048 step_or_micro_step, 0.5 RPS, DEFAULT_SENSE, inversion);

void inversion(void) // Sens inversion
{
  delay(1000); // Wait a bit before leaving in the other direction
  if (Stepper.getPosition() == 0) // If it is in the reference position
	  Stepper.move(Stepper.getStepsPerTurn()); // We take a turn
  else Stepper.moveTo(); // Otherwise we come back in the reference position
}


void setup(){}

void loop(){}