Well, it's bugging me. So I put together a simple code for testing when I get home.
const int latchPin = 3; //ST_CP of 74HC595 (12)
const int clockPin = 5; //SH_CP of 74HC595 (11)
const int dataPin = 4; //DS 0f 74HC595 (14)
const int stepsPerRevolution = 2048;
int forDataArray[4] = {160, 96, 80, 144}; //Clockwise
int revDataArray[4] = {144, 80, 96, 160}; //Reverse
void setup(){
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop(){
for ( int i = 0; i < stepsPerRevolution/4 ){
for ( int e = 0; e < 4; e++ ){
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 0 >> 8 );
shiftOut(dataPin, clockPin, MSBFIRST, forDataArray[e]);
digitalWrite(latchPin, HIGH);
delay(5);
}
}
delay(5000);
}
That should, if my thinking is correct, send to the registers something like the following. Where 1 is on and 0 is off.
00000000 10100000
00000000 01100000
00000000 01010000
00000000 10010000
And repeat that over and over. Right? Wrong?
Wrote it on a text editor on my phone. So, it may/may not compile.