i got an arduino uno and would like randomly choose a number on a specific group of numbers like (1,3,5,7,9) after choosing a number for example 5. it then randomly choose within the remaining numbers (1,3,7,9) . until there is nothing to choose. then it will stop. can anyone help with the code. im using an Led output
search for "Fisher Yates shuffle Arduino" if you want a complete code.
You should explain that better. Do you mean a 7-segment LED display? Please post a link to it.
Hello boss22
Welcome to the world's best Arduino forum ever.
What´s the name of the game?
Have a nice day and enjoy coding in C++.
Put your number set in array and than choose the random element by index
just using 5 colored LED. At first all led is turn on. then randomly turn off the LED 1 by 1 until all led is turned off.
Maybe something like
int led;
do led = random(5); while (digitalRead(ledPin[led]) == LOW);
digitalWrite(ledPin[led], LOW);
hi . i am very new with arduino coding. i got this little project, its about 10 colored led turned on at first. then randomly turn off 1 by 1 until its all off. then turn on all again at the last. i really appreciate the help
You started a topic in the Uncategorised category of the forum whose description is
DO NOT CREATE TOPICS IN THIS CATEGORY
Your topic has been moved to a more relevant category
What code have you written so far that you need help with ?
Do you know how to turn an LED on/off ?
Do you know how to generate a random number ?
c++ but that was a long time ago. i got a arduino uno and wolld like to ask for help about my project
Good, because that is what the Arduino is programmed in, with extensions to allow control of the microprocessor
Your 'photo shows 8 LEDs. Have you written any code to turn any/all of them on or off ?
i have not. i just copy from the net. tried the random blinking led
Did you succeed ?
Whether or not you succeeded, please post your sketch, using code tags when you do
That picture looks familiar. Did you cross-post?
I'm curious. This is a cross-post, which is against forum rules. No doubt you will say that you did not know about this rule, and I have no problem believing you that you don't, not having read the forum rules. But what I'm curious about is your motivation for posting this. Please be honest with your answer. Were you unhappy with the answers on the other topic? Could you not find the other topic when you returned to the forum?
I think OP expected the ready code, but got only advises