Alternating between arrays (With Python example)

Gonna include a Python example this time of what I want to have happen. I believe the solution will be fairly straightforward and clear now.

Previous question.
"How to alternate between 10 LEDs

Lighting say series1 (1,3,5,7,9)

and then turning off series1 and lighting series2 (2,4,6,8,10)

repeatedly?"

I have pin 4 to 13 mapped. Resistors and all, already made some code with help from the "For Dummies" book and playing around.

Python Code:

import time

delay = 0.5
constant = 1
stage = 1
LED1 = (4,6,8,10,12)
LED2 = (5,7,9,11,13)

while constant:
   while stage is 1:
       print(LED1)
       stage = stage - 1
       time.sleep(delay)

   while not(stage):
       print(LED2)
       stage = stage + 1
       time.sleep(delay)

#The Result:

(4, 6, 8, 10, 12)
(5, 7, 9, 11, 13)
(4, 6, 8, 10, 12)
(5, 7, 9, 11, 13)
(4, 6, 8, 10, 12)
(5, 7, 9, 11, 13)

All LEDs get set to HIGH each line simultaneously, obviously I still need to include a LOW line. But this is what I'm trying to figure out, the array.

You have posted code without using code tags. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click. Also, if you don’t do it, some of the character sequences in the code can be misinterpred by the forum code as italics or funny emoticons. The “Code: [Select]” feature allows someone to select the entire sketch so it can be easily copied and pasted into the IDE for testing.
If you have already posted without using code tags, open your message and select “modify” from the pull down menu labelled, “More”, at the lower left corner of the message. Highlight your code by selecting it (it turns blue), and then click on the “</>” icon at the upper left hand corner. Click on the “Save” button. Code tags can also be inserted manually in the forum text using the code and /code metatags.

Have you had a look at the Blink example yet, to get a feel for how you will do at least the LED interfacing in C language?

You seem to have a good idea there to use arrays in C, but seemingly haven't made any effort to research them.

A two dimensional array is probably best for this, so you can alternate lists easily:

byte pins[2][5] = { {4,6,8,10,12}, {5,7,9,11,13} };

I've only yet looked on forums for small specific solutions. I only really know Python so far. Smaller questions are easier to find than with Arduino code for some reason I have to admit. Just for at least learning the code/syntax etc.

Generally it would work like:

for (int i=0; i<2; i++)
{
  for (int j=0; j<5; j++)
  {
  digitalWrite(pins[i][j], ON)
  }
  delay()
  for (int j=0; j<5; j++)
  {
  digitalWrite(pins[i][j], OFF)
  }
}

SOLVED (Super close at least): So I put “byte pins…” at the top BEFORE setup, apparently this is in “global scope” to solve scope not declared error. everything else I tweaked a little here and there as you can see, everything works exactly how I wanted except for the LEDs brightness - it’s extremely low.

byte pins[4][13] = { {4,6,8,10,12}, {5,7,9,11,13} };

void setup() {


}

void loop() {

for (int i=0; i<2; i++)
{
 for (int j=0; j<5; j++)
 {
 digitalWrite(pins[i][j], HIGH);
 }
 delay(500);
 for (int j=0; j<5; j++)
 {
 digitalWrite(pins[i][j], LOW);
 }
}
}

bainy:

byte pins[4][13] = { {4,6,8,10,12}, {5,7,9,11,13} };

the numbers inside the are not pin numbers. They represent the dimensional size of the array. That is why mine was sized [2][5], because you have 2 arrays of 5 pin numbers.

As for the LEDs brightness, please post a schematic or photo.