If you can afford it, and you really want to make working with a stepper super easy check out Easy Stepper. I was very pleased.
From the example code page
http://www.sc-fa.com/blog/wp-content/uploads/2013/04/20130414-080645.jpg
Example 1: Basic Arduino setup
This is the most basic example you can have with an Arduino, an Easy Driver, and a stepper motor. Connect the motor's four wires to the Easy Driver (note the proper coil connections), connect a power supply of 12V is to the Power In pins, and connect the Arduino's GND, pin 8 and pin 9 to the Easy Driver.
Then load this sketch and run it on your Arduino or chipKIT:
void setup() {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
void loop() {
digitalWrite(9, HIGH);
delay(1);
digitalWrite(9, LOW);
delay(1);
}
Also from the same page, here's some example code to run two motors with two easystepper boards, with acceleration/deceleration:
http://www.sc-fa.com/blog/wp-content/uploads/2013/04/20130414-081018.jpg
#include <AccelStepper.h>
// Define two steppers and the pins they will use
AccelStepper stepper1(1, 9, 8);
AccelStepper stepper2(1, 7, 6);
int pos1 = 3600;
int pos2 = 5678;
void setup()
{
stepper1.setMaxSpeed(3000);
stepper1.setAcceleration(1000);
stepper2.setMaxSpeed(2000);
stepper2.setAcceleration(800);
}
void loop()
{
if (stepper1.distanceToGo() == 0)
{
delay(500);
pos1 = -pos1;
stepper1.moveTo(pos1);
}
if (stepper2.distanceToGo() == 0)
{
delay(500);
pos2 = -pos2;
stepper2.moveTo(pos2);
}
stepper1.run();
stepper2.run();
}
the Arduino (ATmega) will report HIGH if: a voltage greater than 3.0V is present at the pin (5V boards)which contradicts the statement in this postIf analogRead(A0) is greater than or equal to 512, digitalRead(A0) will be 1, else 0. – dotancohen Nov 13 '19 at 12:09