Introduction: RegisterWrite - Extending the Outputs of Arduino/Microcontroller With Shift Registers

Register Write is a program example to extend the outputs of the Arduino using a shift register.

I have wrote a simple sketch that will use 3 outputs of the Arduino to drive the shift register.

I wrote this as I could not find any similar code to drive an output of a shift register directly on the web.
I kept code very simple with no loops etc to be understandable by beginners.

In my case I used a 74HC595 - 8 bit shift register, thus 8 outputs. It could easily be altered to drive more shift registers.

Then I created a function which is very similar to driving a
Pin output ( digitalWrite(PinNo, LOW); ) which I named
Register Write ( registerWrite(PinNo,HIGH); )

Code-wise I didn't use any loops to keep it clear and simple, and as well added lot of comments.

Hope this could be useful.

In my example I outputted 2 outputs flickering like a police siren.

I used an Arduino Mega 2560 with Arduino IDE 1.6.5 with ld.exe of V1.0.5

Step 1: Some Images of the Arduino Connections to the LEDs

Step 2: Wiring the Shift Register

The shift register wiring which I got from the arduino website.

Step 3: Output the Register Pin As You Would With the Arduino Pin.

Step 4: The Sketch