Further to my post of the same subject today. Many thanks to Terry King 'terry@yourduino.com' for the CW/CCW sketch...it worked great CW & CCW then I left it alone for a while and came back to it later and the stepper would only move CW. My indicators showed the sketch loop was performing the CW and CCW OK. Please see attached photo with setup including an lcd to indicate L/R movement. IDE 1.8.0 and sketch below. I made sure the wires are 6=1, 7=2, 8=3, 9=4 for the stepper with same in the sketch definition. I was quite happy with the progress and looking forward to my next step...so, now disappointed.
My thoughts:
1. did something happen to the IC on the 2003 board?
2. is the 28BYJ-48 is low-end piece of junk?
3. if #2 is yes, can anyone suggest a good stepper model?
4. arduino compiles and uploads A-OK for lcd and serial operation.
/* YourDuino.com Example Software Sketch
Small Stepper Motor and Driver V1.4 11/30/2013
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=126 Steps one revolution of output shaft, then back
terry@yourduino.com */
/*-----( Import needed libraries )-----*/
#include <Stepper.h>
/*-----( Declare Constants, Pin Numbers )-----*/
//---( Number of steps per revolution of INTERNAL motor in 4-step mode )---
#define STEPS_PER_MOTOR_REVOLUTION 32
//---( Steps per OUTPUT SHAFT of gear reduction )---
#define STEPS_PER_OUTPUT_REVOLUTION 32 * 64 //2048
/*-----( Declare objects )-----*/
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
//The pin connections need to be 4 pins connected
// to Motor Driver In1, In2, In3, In4 and then the pins entered
// here in the sequence 1-3-2-4 for proper sequencing
Stepper small_stepper(STEPS_PER_MOTOR_REVOLUTION, 6, 7, 8, 9);
/*-----( Declare Variables )-----*/
int Steps2Take;
#include <LiquidCrystal.h> // call up the lcd library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() /*----( SETUP: RUNS ONCE )----*/
{
// initialize the serial port:
Serial.begin(9600);
lcd.begin(16,2);
// Stepper Library sets pins as outputs
}/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
Serial.println("SWEEPING RIGHT");
Serial.println(""); // give a line space
lcd.clear();
lcd.print("Sweep Right");
Steps2Take = STEPS_PER_OUTPUT_REVOLUTION/2; // Rotate CW 1 turn
small_stepper.setSpeed(500);
small_stepper.step(Steps2Take);
delay(1000);
Serial.println("SWEEPING LEFT");
Serial.println(""); //give a line space
lcd.clear();
lcd.print("Sweep Left");
Steps2Take = - STEPS_PER_OUTPUT_REVOLUTION/2; // Rotate CCW 1 turn
small_stepper.setSpeed(500); // 700 a good max speed??
small_stepper.step(Steps2Take);
delay(2000);
}/* --(end main loop )-- */
/* ( THE END ) */