#include <avr/io.h>
#include <util/delay.h>
void setup() {
Serial.begin(9600);
DDRB &= 11111110;//set the first bit. you can also write 254
DDRB ^= (1 << 5);//set the 5th bit by shifting
PORTB ^= 1;//enable the pull-up
}
void loop() {
int x = PINB & 1;//store the value of the pin
if(x == 1){
delay(10);//optional
PORTB ^= (1 << 5);
Serial.println("released");
}
else{
delay(10);//optional
PORTB &= ~(1 << 5);
Serial.println("pushed");
}
}