Converting 8-bit binary array to decimal number

Hi

I have an array containing eight values which can either be 1 or 0.

I want to display the value of these eight values on a row of LEDs, via a shift register. However, the 'shiftOut' function appears to only allow a decimal number to be sent.

So, how can I convert this array...

int myArray [] = {0,0,1,1,0,1,0,1};

...and place it as a decimal number into myVariable I can slot in here?

shiftOut(dataPin, clockPin, MSBFIRST, myVariable);

Thanks!

The first thing to do is to make it a byte array to save space. Then read each entry in the array and use bitWrite() to set the bits in a variable then shift out the variable. Better still set the bits in a variable in the first place instead of using an array.

mask = 0x80;
myVariable = 0;
 for(int j = 0; j < 8; j++).{
    If( myArray[j] == 1) myVariable |= mask;
  mask = mask >> 1;
}

That assumes the most significant byte is in myArray[0] If not make mask = 1 and reverse the direction of the shift.