Instructions

hardly foreseeable anymore from the xth decimal digit
onwards. They change irregularly if the divisor is regu-
larly increased as well. This result appears random, but
can be reproduced by an identical program or by call-
ing the program again at any time. However, if taking a
number made up of some of these numbers and once
again dividing it by a number that results from the
current second of the time or the content of any
memory digit of the computer, the result cannot be
reproduced and is therefore called a random number.
5. Day
Switching the LED with a button
A button closes a connection between the two contact strips while the button is pushed. Releasing the button separates the connection. To
switch on an LED every time the button is pushed, all you need is to close a circuit. A program is not necessary. The experiment of the 5th day
switches the LED on with one push of a button and off again with the next.
Components: 1 x plug board, 1 x LED red, 1 x 220-Ohm
resistor, 1 x button, 4 x connection cables
ScratchGPIO uses internal pull-up resistors in the Raspberry Pi, so that GPIO inputs clearly have the value 1 in the unconnected condition. Con-
necting this kind of GPIO input to GND will cause it to take the value 0. GPIO inputs can only take the values 1 or 0.
The program
In an endless loop, the program will wait until the user pushes the button. Then the LED is switched on. Then the program will again wait until
the user pushes the button. Now the LED is switched off again and the endless loop starts over.
The program
05taster
switches the LED with a button
The Scratch block wait until... makes the program wait until a specific condition is met. Conditions are blocks with pointed ends, most of them
found on the block pallet operators.
The current value of a GPIO-input is checked with the block value of sensor... of the block pallet feel. The list field contains all GPIO inputs for
selection.
After the LED has been switched on or off, the program will wait for 0.2 seconds. Such "time-outs" are integrated whenever programmes com-
municate directly with hardware. Simply said, they prevent a programme from "overdoing it" and missing some hardware event.










