I've just had my first go at getting a shift register to work with my Arduino.. it was almost flawless, but I seem to be missing my first bit.
I followed the guide here, but using only one shift register:
http://arduino.cc/en/Tutorial/ShiftOut
It took a little while to figure out, but it appears as though pin Q1 on my shift register is lighting up when I send the number 2, Q2 is high for 4, Q3 = 8 etc.. when I call shiftout() with the number 1 no LEDs come on.
I checked my wiring and it seems fine.. then I double checked and it's definitely fine.
The only things I can think of are:
1. My shift register is slightly different to the one they're using.. it's a 595N, not a 595.
2. I've done something wrong in the code..
In loop():
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 1);
digitalWrite(latchPin, HIGH);
Does anyone have any tips on debugging this issue?
Cheers,
John
Best Answer
The shift register is behaving exactly as designed.
The second-from-lowest significant bit should be lighting up for a value of 2. That's Q1.
To check for a value of "1", you need to be looking at the least significant output bit, which is Q0.
Also, the 595 and 595N are not functionally different.