User manual

An infinite loop reads the value of the analogue Pin 0 and rounds it to a digit between 0 and 9. This value is stored in the variable n and, if it is
0, set to 10 in order to display the tenth list element. Then the loop you already know switches on the LED segment that matches the digit.
Day 20
Today on the Advent calendar
220-ohm resistor (red-red-brown)
Countdown for flashing light with 7-segment indicator
Components: 1xbreadboard, 1x7-segment indicator, 10x220-ohm resistor (red-red-brown), 1x 20-Mohm resistor (red-black-blue), 2x clay
contact, 11xconnection cable, 4xinsulated jumper (varying lengths)
When the clay contact is touched, a ten-second countdown starts on the 7-segment indicator, after which the RGB LED flashes white briefly. For
this purpose, all three anodes of the RGB LED are connected to the same Arduino pin with series resistors.
The programme
The main program loop waits first until the clay contact is touched and then causes a countdown to run from 9 to 1. At the end, the 7-segment
indicator is set to 0 and the LED is switched on for 0.1 seconds.
The same method you know from earlier programmes is used again to display the digits.
Script block for display of a number
Day 21
Today on the Advent calendar
20-Mohm resistor (red-black-blue)
This resistor will not be needed until the next few days.
Guess the number with 7-segment indicator
Components: 1xbreadboard, 1x7-segment indicator, 7x220-ohm resistor (red-red-brown), 3x 20-Mohm resistor (red-black-blue), 4x clay
contact, 12xconnection cable
The game generates a random number that the player must guess. You can use the clay contacts to increase or decrease the number that is your
own guess by steps. The clay contact marked with the square submits the guess.
The programme
In an infinite loop, a secret number x is first randomly defined. The displayed starting number is likewise randomly defined and stored directly
in the variable n, which is used as in past programmes for presentation on the 7-segment indicator. The player's guess is stored in the variable y.
The main loop of the game runs until this guess is equal to the number sought.
At the beginning of each pass, the currently set number n is shown in the 7-segment indicator. After that follow three if queries that check the
three clay contacts.
If the contact at Pin 2 is touched, the number shown is increased by 1. An internal if query prevents this number from becoming greater than 9.
If the contact at Pin 1 is touched, the number shown is decreased by 1. Here, too, the number is prevented from falling below 1.