Skip to main content
deleted 9 characters in body
Source Link
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 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.

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.

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

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;

//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.

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.

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.

edits in the form of the answer
Source Link
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.

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

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.

Source Link
Mero55
  • 201
  • 1
  • 6
Loading