Hi good people of Arduino forum :)
Me and my friend are new with arduino and are right now working on our first arduino project in school.
Its supposed to be a pretty simple game with a led blinking a random amount of times after pressing button no 1.
Then a person is supposed to press button no 2 the same amont of times as the led was blinking.
We've got two additional leds showing if he got it correct or wrong.
But or problem now is the "correct led" is lighting up as soon as the player reaches the correct number of blinks.
Lets say the correct number of blinks is 8.
We want the player to be able to pass number 8 without the "correct led" lighting up.
Perhaps the "correct led" should light up if the player has pressed 8 times, stayed there and waited 10 sec.
If he reaches number 12 and stayes there for 10s the "wrong led" should light up instead.
I have great news! You get to learn about “finite state machines”!
You’ve described three states: showing the goal (button 1 clicked), collecting the user’s guess (button 2 held), displaying the results (don’t care about the buttons). Your code essentially has two states: showing the goal and “other” (collecting the user’s guess and displaying the results lumped together). You need split “other” into two separate states.
Mull over the junk above. If that isn’t enough to help, report back.