Skip to main content
3 of 5
edits in the form of the answer
Igor Stoppa
  • 2.1k
  • 1
  • 15
  • 20

I can't tell exactly whats not working with your code,it would be really helpful if you elaborate more. But here is I report some code that I wrote and I think it will get the job done:

//declare our variables: int myPins[] = {2, 4, 8, 3, 6}; //Enter the number of the pins being used int RNum = 0;

void loop() {

DigitalWrite(myPins[RNum],LOW);
RNum = Random(0,MAX) // MAX being the number of LEDs connected minus one 
//the above generates a random number 

DigitalWrite(myPins[RNum],High);

}

This will turn on one LED at a time.

Mero55
  • 201
  • 1
  • 6