Instructions

Components: 1 x plug board, 4 x 20 MOhm resistor, 5 x
wire bridges (sensor contact), 6 x connection cables, 4 x
alligator clamp cable, 4 x putty contact
The program
The script for the ball makes it bounce off of the edges as in the pong game. If one of the two paddles is touched, the flight direction is changed
a little at random.
Two variables save the points of the players. Each player is awarded a point when the ball touches the opponent's base line. The two paddles
have program blocks that query two sensor contacts each in endless loops and move the paddle up or down when touched.
20. Day
Dice with LEDs
Everyone knows and owns the typical game dice with 1 – 6 pips. Electronically controlled dice that make the pipes light up at the push of a
button is much cooler – but they shouldn't just light up as 1 – 6 LEDs in a row, but in the placement as on game dice. The rolled number is dis-
played until the next number is rolled.
Components: 1 x plug board, 2 x LED red, 2 x LED yellow, 2 x LED green,1 x LED blue, 7 x 220-Ohm resistor, 1 x button, 1 x wire bridge, 6 x
connection cables
The program
An endless loop first waits until the button at pin 26 is pushed. Now the four GPIO-pins used are switched off and the previously displayed
rolled result is deleted.
Then a random number between 1 and 6 is generated and saved in the variable
w
. After the number has been rolled, six if-blocks follow for
every possible value that can be rolled. Each of these blocks switches on the corresponding combination of LEDs when a specific number is
rolled.
Independently of the rolled result, the programme will always wait for half a second after rolling, to keep from tripping two different dice ac-
tions by button bouncing.