User manual

046 {
047 lcd.setCursor(0,1);
048 lcd.print(kapazitaet);
049 lcd.print("nF ");
050 }
051 else
052 {
053 lcd.setCursor(0,1);
054 lcd.print(kapazitaet/1000);
055 lcd.print("uF ");
056 }
057
058 delay(1000);
059 }
RANDOM NUMBERS
THE LOTTERY RESULTS
GENERATOR
When writing measuring, control, regulating or playing programs,
it is often of benefit to generate random numbers, e.g. when
lights are to go on and off at different times in a house to
program a presence simulator. For this purpose, the Ar-
duino™-random()-function can be used. This permits a simple
lottery number generator that will draw 6 out of 49 for you. You
will no longer have to think about which numbers you are supposed
to take when you complete your lottery slip.
For the setup of the lottery number generator, you need a button
and an aerial. The button is debounced in the software. The button
and switch tend not to close the contact 100 % at once but to
trigger several times after being pushed. This is comparable to
tossing a ball to the floor. It will bounce a few times before
finally resting on the ground. This happens much faster in a
button, but the Arduino™-micro controller is so fast that it will
still record these millisecond »hops«. To avoid this, the button
is debounced by being queried twice in sequence with a break of
50 ms, which is enough for a debouncing routine in practice . Only
if the second evaluation still recognises a LOW at input D7 will
the instruction between the brackets be executed.
At commencement of the program, we switch the port D7 to INPUT