ShiftOut Clock Pin - Pin 12 only? [solved]

Hi,

Done the ShiftOut tutorial, everything's fine, LEDs work as expected, but only when the Clock Pin is set to 12 (i.e. when the 74HC595 SH_CP Pin, which is IC Pin #11, is connected to Pin 12 on the Arduino). I've moved the Latch and Data pins to other outputs without problems, but whenever I set the Clock Pin to be other than the Arduino's 12 pin, I get funky behavior (LEDs flashing, not resetting properly etc). Why is that?

Perhaps post your code and circuit diagrams?

The code is long and rather irrelevant. I copy and paste the essential bit:

// Set the pin variables for addressing the 8-LED display
// Pin connected to ST_CP of 74HC595
int latchPin = 2;
// Pin connected to DS of 74HC595
int dataPin = 3;
// Pin connected to SH_CP of 74HC595
int clockPin = 12;

White wire: latchPin
Blue wire: dataPin
Yellow wire: clockPin

Actually after further testing, everything's fine as long as the Clock Wire (yellow) is connected to Arduino pin 10 to 13 (and the code updated accordingly). If I connect to pin 9 or any pin below that, the LEDs don't behave as expected. Is there some fundamental difference between pins 10-13 and 2-9?

Cam-1.jpg

Where's the part (code) where you do something with the shift register? The code you posted does not mean anything.... There might be a bug in your code somewhere.

Ischia:
Hi,

Done the ShiftOut tutorial, everything's fine, LEDs work as expected, but only when the Clock Pin is set to 12

Ischia:
The code is long and rather irrelevant. I copy and paste the essential bit:

The code on the linked page is not long and irrelevant. Are you saying that, using that, the LEDs don't work? Make up a test case, complete code, that demonstrates the problem, and post that.

Is there some fundamental difference between pins 10-13 and 2-9?

Pins 10 to 13 are used for hardware SPI, however the code on the linked page doesn't use that, and as for your code, well we can't see that.

I'm sorry for all this, it was of course stupid of me to assume the code was not to blame. I didn't want to paste it because it's very long, but it turns out I was sending servo commands to the HC595...

Thanks a lot for your help.