Skip to main content
1 of 5
Mero55
  • 201
  • 1
  • 6

I can't tell exactly whats not working with your code,it would be really helpful if you elaborate more. But here's 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