I can connect and use a 7seg display, also a random function. But now it is the intention that I push a buttonso it can print a random number of 0-8 on the 7seg display but also the same number on 0-8 LEDs. So I would have to use a 74HC595 shift register since I do not have enough outputs.
Break the problem down into steps. Some of the steps will be easy for you to write code for. Some will not. Break those steps down into smaller pieces, until you CAN write all the code.
You need, as I see it, to react to a switch press, to generate a random number, to apply that number to a 7 segment display, and to apply that number to a shift register in such a way that one or more LEDs lights up.
Which of those steps looks even remotely difficult to write the code for?
By the way, you only need 4 LEDs to show a value from 0 (0b0000) to 8 (0b1000).
If that's all it does, then why use a shift register? 7 pins for the numeric display, 8 pins for 8 individual LEDs, one for the button and 1 for an unconnected analog input pin to provide a random seed. 17 pins. If you don't use 0, 1 or 13, then that's how many pins an Arduino has.
ChrisTenone:
If that's all it does, then why use a shift register? 7 pins for the numeric display, 8 pins for 8 individual LEDs, one for the button and 1 for an unconnected analog input pin to provide a random seed. 17 pins. If you don't use 0, 1 or 13, then that's how many pins an Arduino has.
Hi
Our arduino leonardo brainbox has only 12 outputs/inputs... So I need a shift register.