Sorry for one more post about getting stuck with shift registers. I see a lot of posts related, one book and a lot of tutorials. I don't know what is wrong with what I have implemented. I try a lot of things:
- interchange connection from arduino to latch pin, clock_pin and data_pin in several forms.
- use four 595 chips to make sure it was not damaged.
- change the code in too many whays.
- change some jumper cables
I took several photos of the breadboard and the connections but it is to be the same in general of several tutorials about this shift register. Sorry if it's confusing, I tried to take a lot of pictures, but I can't tell if its clear.
The final version of source code is:
int latchPin = 8;
int clockPin = 12;
int dataPin = 11;
void setup() {
Serial.begin (9600);
pinMode (latchPin, OUTPUT);
pinMode (clockPin, OUTPUT);
pinMode (dataPin, OUTPUT);
}
byte i = 0;
void loop() {
Serial.println (i);
digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST,i);
digitalWrite (latchPin, HIGH);
delay (500);
i ++;
if (i > 255) i = 0;
}
With this version I don't see almost anything in leds. If I put an extra delay after shiftOut like below code I see a few scattered flashes. But it seems don't make sense. It's not a binary counter at all.
digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST,i);
delay (500);
digitalWrite (latchPin, HIGH);
delay (500);
Is there any problem in using the pinout:
11, 12 and 14 of 595 plugged respectively on pins 11, 12 and 13 of the Arduino?
One more thing:
I think the pinning of the tutorials very confusing and error-prone. But I have not seen any examples using this other pinout, which for me is much easier. Is there any reason to don't use the pins like that?
