#include <avr/io.h>
#include <stdint.h>
#include <util/delay.h>
int main() {
DDRD |= 0b00000001; // Set PB0 as an output (LED)
DDRC &= 0b11111110; // Set PC0 as an input button
PORTC = 0b00000001; // Turn on the pull-up resistor
while(1) {
int delay_time = 500;
// Check if the button is pressed
if((PINC & 0b00000001) == 0) {
delay_time = 100;
}
// If the button is pressed, PB0 should blink fast
// If the button is not pressed, PB0 should blink slow
PORTB ^= 0b00000001;
_delay_ms(delay_time);
}
}