array question

Ok so i'm making a led cube and all that's left to do is program the arduino.

/*
*3D LED Cube (Preliminary Code)
*Counts to 25 then convert to Binary and Light Cube
*
*/


int ledPins[6];
int pinCount = 6;
int iterations = 24;
int timer = 100;

void setup() {
  int pins;
  for(int pins = 0; pins < pinCount; pins++)  {
    pinMode(ledPins[pins],OUTPUT);}
//  pinMode(2, OUTPUT); // Sets pin '2' as LSB
//  pinMode(3, OUTPUT); // 
//  pinMode(4, OUTPUT); //  COMMENTED OUT; SMALLER CODE ABOVE
//  pinMode(5, OUTPUT); //
//  pinMode(6, OUTPUT); // Sets pin '6' as MSB
}
void loop(){
  int Iiterations;
  for(int Iiterations = 0; Iiterations < iterations; Iiterations++)  {
  digitalWrite (6,HIGH);
  }
}

The program above is what i have so far...but just for starters im only going to light up the top layer of cube in a counting sequence to help me understand arduino better. Now what i have my arduino connected to is 2(two) 74hc4514 4:16 demultiplexers. I only want to use 5-6 outputs on my arduino to control the cube using binary code to select an led
EX: 00000 = Led 1; 00001 = led 2;......01010 = led 11.
The issue that i'm having is i want to store each individual bit in the array.
EX: The binary 0(zero) will be stored in the array as 0|0|0|0|0; 1 = 0|0|0|0|1........ect.
I know how to convert to binary but as far as separating the number and storing these values i get stuck...
... Im not asking anyone to write the code or anything but what is the best method to go about doing this??

Variable names differing only by case is a bug waiting to happen.

Iiterations

I - iterations ? What's the rationale behind this strange naming scheme ?

Seems to work for Apple. :slight_smile:

AWOL:
Seems to work for Apple. :slight_smile:

For Aapple, probably... If he worked for Apple, he'd write iIterations... :stuck_out_tongue:

the i at the beginning stands for initial... so that i know that it starts at zero... im more of a hardware person... im fairly new to programming. I know some basics but i want to understand more how to use arrays. i think the best way to do it is to count in binary from 0 to 24 and just have it display on the top layer of the cube rather than using a 7 segment led display

Ok let's try to be constructive...

void loop(){
    // local variable to be used as for() index -> ok (more on its name later)
    int Iiterations;
    // the index variable is redeclared -> ok but makes previous declaration redundant
    for(int Iiterations = 0; Iiterations < iterations; Iiterations++)  {
        // no need to repeatedly "write" the same state to a pin
        digitalWrite (6,HIGH);
    }
}

About the variable names, better (and more standard) choices would have been:

void loop(){
    int i;
    for(i = 0; i < numIterations; i++)  {
        digitalWrite (6,HIGH);
    }
}

I don't really see the point of setting the same pin high more than once, unless you just need to kill some time.