MTstepStepper: Example 3
Event management for Uno, Nano, Mega
Round trip
When you press a button an stepper turn, once in two in one direction, once in two in the other direction.
Complete program recommended
This program is completely under interruption, and releases loop which can be used to do something else.
// When you press a button an stepper turn, once in two in one direction, // once in two in the other direction. #include <MTobjects.h> // V1.0.6 See http://arduino.dansetrad.fr/en/MTobjects const uint8_t PIN_BOUTON = A0; MTstepStepper Stepper(pin_Step 2, pin_Dir 5, pin_EN 8); void front(void) // One full turn { Stepper.move(Stepper.getStepsPerTurn()); } void back(void) // Back to the original position { Stepper.moveTo(); } MTcheckButton Bouton(PIN_BOUTON, front, back); void setup(){} void loop(){}