User manual

96
time.sleep(0.5) If the entry of the sequence was correct, the programme waits for 0.5 second and starts
the next round.
if(ok == True): The programme reaches this point when either the loop has fully run though, that is, the
player has entered the correct sequences, or the previous loop has been discontinued due to a mistake made by
the player. If
ok is still on True the awarding ceremony takes place. Otherwise this block is skipped, and the
game only executes the last command line of the programme.
print “Well done!"
for i in range(5):
for j in range(4):
GPIO.output(LED[j], True)
time.sleep(0.05)
for j in range(4):
GPIO.output(LED[j], False)
time.sleep(0.05)
If the game is won, a message is displayed in the Python shell window. All LEDs are then flashing briefly five
times in succession.
GPIO.cleanup() the last command line is always executed. It closes here the GPIO ports that are used.