Pin assignment in shift register tutorial

Hi,

I just started with Arduino (and electronics).

I setup and ran this tutorial https://docs.arduino.cc/tutorials/communication/guide-to-shift-out#shftout11 based on shift registers.

My question is why is it that clockpin output has to be 12 and datapin to be 11 . Can't we interchange them ? Or Can we choose some other pin, say 11 or 13 to be clock or datapin ?

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;

Thanks for checking this.

p.s: I wanted to post this question in the 'Introductory Tutorials' section, but not allowed as i am a newbie.

-Ash

Welcome to the forum

You were not allowed to post in "Introductory Tutorials" because you are asking a question, not posting a tutorial on how to do something

As to your question about pins, to drive the clock and data pins of a shift register as in the tutorial that you are following you can use any free GPIO pin as long as you adjust the code to match the code

1 Like

Thanks for the quick response. I tried switching the pin assignment and it works.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.