Any simple way to work with the shift register in controlling each output?

:| Hello guys ,I've recently been working with the shift register that the arduino got but when it comes down to controlling each output ,LEDS for example, I found it to be a bit difficult! :cold_sweat: Anyone who can help in explaining this to me in simple words?

Thanks! Abel Wondafrash. Ethiopia,Debre zeit.

Make a pattern, shift it out.

declare a variable to use: byte LEDout;

then set (make high) and clear (make low) the bits as needed:

LEDout = 0b00000010; // bit 1 high LEDout = LEDout | 0b11000000; // make bits 6,7 high, leave others where they were.. result: LEDout = 0b11000010;

clear bit 6 only: LEDout = LEDout & 0b10111111; result: LEDout = 0b10000010

Shift the updated data out: digitalWrite (latchPin, LOW); shiftOut(dataPin, clockPin, MSBFIRST, LEDout); digitalWrite (latchPin, HIGH);

Make sure SRCLR is tied to +5, and OE is tied to Gnd. latchPin connects to RCLK dataPin connects to SerDataIn clkPin connects to SRCLK

Thanks a lot ! But could the 7 segment led display would also be controlled with this shift register? I thought that I heard so! Please explain that to me. :)

Yes, you just need to define a font of letters to be displayed. byte fontArray[] = { 0b0011111111, // 0, with 1 being an On segment 0b00000110, // 1 }; //etc

0b00000000 = DP-g-f-e-d-c-b-a Standard layout: a f b g e c d DP

shiftOut (dataPin, latchPin, MSBFIRST, fontArray[number_to_display]); // look up the font