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

One more turn

This program uses a 28ByJ48 which go for a turn of each press on a button. We will use a simple button, type bell.

Complete program recommended

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

// This program takes a turn when you press a button

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

const uint8_t PIN_BOUTON = A0;

MTulnStepper Stepper(pin_A1 2, pin_B1 3, pin_A2 4, pin_B2 5, ONE_PHASE);

void turn(void) // A full tour
{
  Stepper.move(Stepper.getStepsPerTurn());
}

MTbutton Bouton(PIN_BOUTON, turn);

void setup(){}

void loop(){}