PaulRB:
Yes, I/we can help. What do you have so far?
Can you post a schematic of your circuit? Your picture has spaghetti for wires!
If I understood your original message, the Arduino should choose a random on/off state for each of your 3 leds. The leds should then show this pattern for a length of time, perhaps 5 seconds? If all 3 leds are on and the button is pressed within that time, the player "scores a point". Another sequence is then displayed for 4.5 seconds. If the button is not pressed within the time, the time allowed is increased back to 5 seconds. Am I correct?
What happens if the player presses the button when less than 3 leds are on? Does the time go back to 5 seconds?
What happens when the allowed time gets to 0.5 seconds and the button is pressed? Or is that almost impossible?
How does the game record the highest score (i.e. shortest time) the player has achieved? Does the number of times that the player correctly presses the button give a higher score?
The initial state is, that the three LEDs blink slow in a random order. But when the three LEDs blink at the same time, the player has to press the button at that moment. If the player pressed the button, when the three LEDs blinked, then "the game" goes to the next Level, so LEDs need to blink faster than the first time. So lets say we will make 4 Levels, in each Level the LED blink has to be faster. If the player fails to press the button, when the three LEDs blink at the same, "the game" goes back to the first Level. After the player reached LEvel 4 and wins, all three LEDs should blink together three times. Hope you can help me. All I have so far is this:
int ranNum;
int ranDel;
#define STATE_led0 0
void setup() {
randomSeed(analogRead(0));
current_state = STATE_led0;
// 3 LEDs als Output konfiguieren
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
// Taste als Input konfiguieren
pinMode(5, INPUT);
}
void loop() {
switch(current_state)
{
//Generiert eine zufaellige Zahl zwischen 2 und 5
ranNum=random(2,5);
// Generiert zufällige Delays
ranDel=random(500,300);
//LEDs einschalten
digitalWrite(ranNum, HIGH);
delay(ranDel);
//LEDs ausschalten
digitalWrite(ranNum, LOW);
}
}
But it doesn't work!