So... define your 7 element array of leds like this:
byte myArray[7] = {2,3,4,5,6,7,8};
try code like this:
byte myLeds[7] = {2,3,4,5,6,7,8};// all 7 elements of the display are put into the array starting wiht element zero through element six
byte myMaskArray[10] = { B0000000,B0000000,B0000000,B0000000,B0000000,B0000000,B0000000,B0000000,B1111111,B0111111};
byte blank = B0000000;
byte elementZero = B0000001; //notice the pattern here
byte elementOne = B0000010; //the one has move to the 2nd positionin the byte
byte elementTwo = B0000100; //the one moved to the third position of the byte
void setup()
{
for (byte i = 0; i < 7; i++)
{
pinMode(myLeds[i], OUTPUT);
}
}
void loop()
{
liteLeds(9); //lite the number nine
delay (2000);
liteLeds(8); //lite the number eight
delay (2000);
liteLeds(elementZero); // only led 2 should lite
delay(2000);
liteLeds(elementOne); // only led 3 should lite
delay(2000);
liteLeds(elementTwo); // only led 4 should lite
delay(2000);
liteLeds(blank);
delay(2000);
}
void liteLeds(byte myMask)
{
for (byte i = 0; i < 7; i++)
{
digitalWrite(myLeds[i], bitRead(myMaskArray[myMask],i));
}
}
and see if you can determine how to modify this:
byte myMaskArray[10] = { B0000000,B0000000,B0000000,B0000000,B0000000,B0000000,B0000000,B0000000,B1111111,B0111111};
to correct the output of elements 0 through 8 to display the in the manner you wish