title: ATtiny85 digital "on" output fails to deliver 5 V
body: <p>I am using an ATtiny85 as a micro-controller. I am trying to read two inputs at around 3 V each and output 5 V for every "on" input (more than 1V). I'm using PINB0 &amp; PINB1 for input and PINB3 &amp; PINB4 for output. The problem is when both PINB0 &amp; PINB1 are on, I get two 5 V outputs, but when only one of the is on, I only get 2 V, I'm trying to fix that so I get 5V output.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#inlude &lt;avr/io.h&gt;
  #include &lt;stdint.h&gt;
  
  int main(void)
  {
  // set pin 0 to input (pi signal 0)
  DDRB &amp;= ~(1 &lt;&lt; PINB0);
  PORTB &amp;= 0 &lt;&lt; PINB0;
  
  // set pin 1 to input (pi signal 1)
  DDRB &amp;= ~(1 &lt;&lt; PINB1);
  PORTB &amp;= 0 &lt;&lt; PINB1;
  
  //set pin 3 to output of 0
  DDRB |= 1 &lt;&lt; PINB3;
  PORTB &amp;= 0 &lt;&lt; PINB3;
  
  //set pin 4 to output of 1
  DDRB |= 1 &lt;&lt; PINB4;
  PORTB &amp;= 0 &lt;&lt; PINB4;
  
  while (1)
  {
      if (bit_is_clear(PINB, 0) &amp;&amp; bit_is_clear(PINB, 1))
      {
          PORTB &amp;= 0 &lt;&lt; PINB3;    //output zero volts 
          PORTB &amp;= 0 &lt;&lt; PINB4;    //output zero volts
      }
      else if (bit_is_clear(PINB, 0) &amp;&amp; !(bit_is_clear(PINB, 1)))
      {
          PORTB &amp;= 0 &lt;&lt; PINB3;    //output zero volts
          PORTB |= 1 &lt;&lt; PINB4;    //output 5 volts
      }
      else if (!(bit_is_clear(PINB, 0)) &amp;&amp; bit_is_clear(PINB, 1))
      {
          PORTB |= 1 &lt;&lt; PINB3;    //output 5 volts
          PORTB &amp;= 0 &lt;&lt; PINB4;    //output zero volts
      }
      else
      {
          PORTB |= 1 &lt;&lt; PINB3;    //output 5 volts
          PORTB |= 1 &lt;&lt; PINB4;    //output 5 volts
      }
  }
  }
  </code></pre>