int buttonState = 0;
long randNumber;
void setup() {
randomSeed(analogRead(7));
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, INPUT);
}
}
void loop() {
buttonState = digitalRead(7);
randNumber = random(4000, 7000);
if (buttonState == LOW) {
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}
else {
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(3, HIGH);
delay(1000);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(5, HIGH);
delay(1000);
digitalWrite(6, HIGH);
delay(randNumber);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}
}
Comments