Instructions

24. Day
Christmas tree decoration
The experiment of the 24th day is a flashing Christmas tree decoration.
Components: 1 x plug board, 1 x LED red, 2 x LED
yellow, 1 x LED green, 1 x LED blue, 1 x RGB-LED, 1
x flashing LED, 9 x 220-Ohm resistor, 1 x wire
bridge (connection wire), 10 x connection cables
The program
The five LEDs and the RGB-LED flash entirely at random program-controlledly. The flashing LED from today's door of the Advent calendar will
even flash without a program running. The program uses a list in which the GPIO-pin numbers of the LEDs used are saved. List variables can
have any length in Scratch and may include numbers as well as character chains. After clicking the green vane, all list elements are deleted first.
If the program has been run before, the list would otherwise already contain values. Then the pin numbers of the five LEDs and the three col-
ours of the RGB-LED are saved in the list in sequence. Then an endless loop switches on a GPIO pin randomly selected from the list, and switch-
es off another randomly selected GPIO pin. The program contains no time delay. Since all pins are selected at random, the LEDs will flash for
different times. The RGB-LED lights up in colours that are mixed randomly.
Flashing LED without Raspberry Pi
With an additional power supply of 3 V (e.g. two 1.5-V-batteries), the flashing LED can flash even without the Raspberry Pi running.
Christmas tree decoration with flashing LEDs and external power supply
In this circuit, the flashing LED is connected to its own power supply, independently of the Raspberry Pi. This way, it can flash even without the
Raspberry Pi running. The program remains unchanged since it does not influence the flashing LED.