user25802: 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.

user25806: byte BoolArrayToByte(bool boolArray[8])
{
  byte result = 0; 

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

  return result;
}


25802: <p>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?</p>

<p>I've tried this:</p>

<pre><code>bool ID[8] = {0, 0, 0, 0, 0, 0, 1, 1};
int recivedID = int(ID);
</code></pre>

<p>and</p>

<pre><code>bool ID[8] = {0, 0, 0, 0, 0, 0, 1, 1};
int recivedID = ID.toInt();
</code></pre>

<p>non works.</p>
 25806: <pre><code>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;
}
</code></pre>
