# The Digital Die

## 1 Inputs and Outputs to generate 1-6

### Learn It

• GENIE chips can be programmed with several configurations.
• We'll need 1 pin to provide power to the chip and 1 pin to tie it to ground.
• We'll need 1 pin to program the chip.
• We'll need 1 pin to receive an input.
• This leaves us with 4 pins to play with.
• By right clicking on the GENIE chip in Circuit Wizard, we can choose >Program>Program Settings
• Make sure you have a C08 chip sellected.
• Now you can use the check boxes to make different pins inputs or outputs.
• We're going to want to have as many outputs as possible, so this configuration is probably the best.

### Try It

• If we want to make a die, we need to be able to represent the numbers 1-6 using LEDs
• But we can't simply connect an LED to each output pin, as we only have 4 output pins to use.
• Build the circuit as shown below.

### Try It

• Here's a circuit that allows any number from 1-6 to be displayed by sending output pins high.
• Try to come up with your own arrangement, where we could have any number of LEDs fom 1-6, switch on using only 4 outputs.
• Screenshot your circuit when you have finished it.

## 2 A Program for the Die

### Try It

• We're going to use the circuit shown below to program our Die. It's identical to the one before it, but the LEDs have been placed differently.
• Please note: The resistor on G2 is 330 ohms and the resistors on G0, G1 and G4 are 120 ohms.
• It's a little hard to construct, so you can download it here
• It might help you to understand how the outputs control the LEDs by using the simulation below.

• Use the simulation to write down which outputs will need to be set to high for each number the die will generate from 1 through to 6.
• Using the diagram below and any graphics package you choose, draw a basic diagram to show how the arrangement of LEDs will be connected to the pins of the GENIE chip.
• This silver badge progress ladder indigo - Follow a PCB created by a third party, and identify some of the outputs and inputs.

### Learn It

• With this information, you should now be able to create a program to generate the random numbers.
• You've quite a bit of experience using flowcharts to program GENIE chips already, so here is the start of the flowchart only.

• See if you can come up with an alternative algorithm that doesn't use the `Random` block.