Hi there. First, thank you for your help. Note: I'm not native english, so probably I commit grammar mistakes.
I'm doing an exercise with Arduino that basically is to recreate the typical "Bottle" game with LEDs.
I have 8 leds connected to pins 1-8 and I want them to spin around until (after decreasing the speed), stops pointing randomly someone (one led is HIGH during 10 seconds)
The spinning and decreasing speed is fine, what i don't find is the way to, every time I press the button, ends the cycle pointing someone different. I guess that I have to tell the button to read one of the 8 ends I have in the code, something like "GOTO line XX" action. I don't find the way to make it.
Thank you very much, any help/clue is welcome.
Curro.
You can easily code a kind of physics simulation, that starts with a random "rotation speed", from that calculates with "rotation energy", "friction" and "energy los", until finally the rotation energy is 0 and the system halts.
The moving LEDs will slow down, the movement gets slower, slower and slower and finally the simulation stops at the final LED. Just the same in a simulation as in the game "spin the bottle" with real physics, initial rotation speed, energy, friction, energy loss and stop.
Econjack, as my code skills are really bad, I though that adding 8 different endings to the rotation, finishing in one different LED each "peace of code" could be a solution to it. I see that it doesn't make sense now.
Jurs, thank you for you answer. It sounds great, but I don't know where to start. Any clue? so I can start measuring the variables..