Port manipulation using C code I'm trying to manipulate the ports of Arduino using C code. I have attached an LED to pin 8 and a tact switch to pin 13 (with a pull down resistor). The code works fine, and the results are printed on the screen. So, when the button is pressed, the byte PINB &amp; (1 &lt;&lt; PB5) equals 32, or 0b00100000. 

However, if I try to use

if( PINB &amp;(1&lt;&lt;PB5) == 32){


or 

if( PINB &amp;(1&lt;&lt;PB5) == 0b00100000){


the LED doesn't respond.

Here's the full code:

void setup() {
  DDRB |= 0b00011111; 
  Serial.begin(9600);
  }

void loop() {
  Serial.print("PINB &amp;(1&lt;&lt;PB5)");
  Serial.println(PINB &amp;(1&lt;&lt;PB5));

  if( PINB &amp;(1&lt;&lt;PB5) ){
    PORTB |= (1&lt;&lt;PB0);
    }
  else{
    PORTB &amp;= ~(1&lt;&lt;PB0);    
    }
  }


What am I missing?
== has higher precedence than &amp;, which means that your comparison will be performed incorrectly. But that doesn't matter, since you don't need to check if the port has a specific value, just if the appropriate bit is set.