Skip to content

Instantly share code, notes, and snippets.

@jerivas
jerivas / twin_motor_control.ino
Last active December 20, 2022 23:18
Control two stepper motors' speed and direction with two analog inputs (joystick). By Eduardo Rivas, David Escobar and Ángel Moreno for Universidad Don Bosco de El Salvador, 2013.
/*
Dual Stepper Motor Control (Arduino UNO R3)
Controls the speed and direction of two stepper motors
via two analog inputs. Used to achieve two-dimensional
movement controlled by a joystick. End-of-track sensors
prevent damage to the structure and motors.
Based on "Speed Control" example of the Stepper lib.
Please note the Stepper library produces a bipolar sequence.
By swapping the two middle cables, a unipolar seq. is obtained.