Die Simulation

Die Simulation

To simulate a die, you need 7 LEDs (and 7 resistors). Because the ATtiny85 has only 4 outputs we need to wire up the LEDs in a cunning way. First task: wire up the 7 LEDs with 4 buttons so that you can get all the dice numbers from 1 to 6 by pressing various combinations of the buttons. You should draw out your circuit diagram before you start putting it on the breadboard.
Image
When you have got that working, you can replace the 4 switches with 1 ATtiny85 chip and write a simple program to flash the 4 output pins at different rates to check that the circuit is correct. (use one of the buttons as an on/off button for the chip) Then you can write a program to generate a random number between 1 and 6 and then light up the appropriate pins!
Once it's working, you may want to solder a permanent version onto veroboard (first draw out your circuit and work out how to make it as small and efficient as possible!)
Image