User manual
028
029 }
030
031 void loop()
032 {
033 lcd.clear();
034 lcd.setCursor(0, 0);
035 lcd.print("PUSH BUTTON");
036
037 while(digitalRead(button));
038 {
039 if(!digitalRead(button))
040 {
041 delay(50);
042 if(!digitalRead(button));
043 {
044 lcd.clear();
045 lcd.setCursor(0, 0);
046 lcd.print("YOUR LOTTERY NUMBERS");
047
048 lcd.setCursor(0, 1);
049 for(i=0;i<Anz;i++)
050 {
051 zahl=random(49);
052 zahl++;
053 lcd.print(zahl);
054 lcd.print(" ");
055 delay(500);
056 }
057
058 delay(5000);
059 }
060 }
061 }
062 }
When starting the program,
randomSeed()
generates a value as
starting point for the
Random()
-function. When changing the value
of
randomSeed()
, different random numbers will be generated in each
case. If the value of
randomSeed()
always were the same when the
program starts, the same random number series would be generated
every time, which would not be helpful for playing lottery.
Our aerial is used here. To produce different values with the
function
randomSeed()
, we use an ADC-input connected to a jumper
and remaining open on the other side. This acts like an aerial
and produces a higher noise at the analogue input and thus a
different value for
randomSeed()
in each case. This works best if