#include <avr/io.h>
#define BUTTON_PIN 5 // Define the button pin
#define LED_PIN 5 // Define the LED pin
int main(void) {
// Set PD5 as input (button pin)
//DDRD &= ~(1 << BUTTON_PIN);
DDRD = 0x00;
// Enable pull-up resistor on PD5
//PORTD |= (1 << BUTTON_PIN);
PORTD = 0x20;
// Set PB5 as output (LED pin)
// DDRB |= (1 << LED_PIN);
DDRB = 0x20;
while (1) {
// Read the state of PD5 (button)
if (PIND & (1 << BUTTON_PIN)){
// Button is not pressed, turn off the LED
PORTB &= ~(1 << LED_PIN);
} else {
// Button is pressed, turn on the LED
PORTB |= (1 << LED_PIN);
}
}
return 0;
}