This example demonstrates how easily the programs and experiments of the Thames and Kosmos microcontroller kit's user manual can be combined and extended.
The seven LEDs in the kit allow us to display the numbers between 1 and 6 the way it is done on the faces of a dice.
We only need 4 ports to trigger the LEDs! Since all Eyes of a dice except for the middle one occur in pairs we can connect these pairs to a single port each.
That leaves a spare port for some sound-atmosphere while the dice is rolling. The "Beep" indicates that the dice has come to a stop.
Instead of a push-button we use the motor with the wheel on it's top to roll the dice: Once we spin the wheel clockwise the dice starts rolling until we stop the wheel or it comes to a stop by itself. To avoid this from happening too soon we mix the dice-program (Number 32 in the manual) with the stop-and-go program (92). So the motor helps out a little to keep the wheel spinning. The volume of the sound can by adjusted with the knob, the push-button is an alternative for rolling the dice.