How to convert bool array to byte? I have following problem:
I'm reading 8 bit signal from one Arduino pin and store all informatin in bool array. Now I want to convert this array to single byte in decimal. How to do this?

I've tried this:

bool ID[8] = {0, 0, 0, 0, 0, 0, 1, 1};
int recivedID = int(ID);


and

bool ID[8] = {0, 0, 0, 0, 0, 0, 1, 1};
int recivedID = ID.toInt();


non works.
byte BoolArrayToByte(bool boolArray[8])
{
  byte result = 0; 

  for(int i = 0; i &lt; 8; i++)
  {
    if(boolArray[i])
    {
      result = result | (1 &lt;&lt; i);
    }
  }

  return result;
}