ok, i got the following: Generate array with random values - Programming Questions - Arduino Forum
int array[12] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80 } ;
void setup()
{
Serial.begin(115200);
// next 3 lines are for randomizing the randomgenerator.
Serial.println("press a key");
while (Serial.available() ==0);
randomSeed(micros() + Serial.read());
// this is the trick
for (int i= 0; i< 80; i++)
{
int pos = random(80);
int t = array[i];
array[i] = array[pos];
array[pos] = t;
}
for (int i= 0; i< 80; i++)
{
Serial.print(i);
Serial.print(": ");
Serial.println(array[i]);
}
}
void loop(){}
it went to 12, i changed it to 80 for my project..
i would like to know how to connect 80 leds (bi-color) together and each turn on based on number generated.. IE, if number 12 is generated then led 12 will light up and stay lit - a delay of say 2 seconds another random number is generated - say number 4, then led 4 will light up and stay lit as well.
the only other thing that needs to be added to the code is only draw 20 numbers then stop OR delay for like 10 seconds then turn off all lit leds and start the process over..
please be clear on instructions because i have never done this before.. i don't how many chips, resistors, ect.. i need, but i do believe i have all the things needed - i gathered a bunch of stuff for past projects but have never used them.
thank you in advance,
Ruffsta