Hi guys,new to arduino and programming,and I know basic electronics.Ive decided to start on a simple project.I'm trying to generate a random number between 0 and 5,(I can do that part),but what i want to do is to use that number,then generate another random number and recall the first then the second number and use those,then get a third number ,then use first second and third etc etc, up to around 40 numbers i need to store,all between 0 and 5,as this is the basis of my project.I will be changing the random numbers to be used in another part of my program which I have (I hope)succesfully accomplished.I will also need to clear these numbers when im done.Can anyone help me as to how I can do this.
Learn how to use arrays.
I forgot to mention that I will be choosing an amount of random numbers.This will be for a game that has multiple levels.If i select level 1,I want 5 random numbers selected one at a time,then recalled in sequence,level 2,10 numbers ,etc etc.Will arrays work for this scenario.....thanks to all who have already responded
Yes arrays are the way to go. Just make the array large enough for the highest level when you first declare it. If all you need is numbers 0..5, then a byte array will suffice.
thanx AWOL .I'll give it a try,although new to it all,I like the challenge,hope i can be of assistance to you some day