#include <avr/io.h>
#include <util/delay.h>
//DDR 1 SALIDA, 0 ENTRADA
#define LED_PIN 13 // Pin digital 13 para el LED
#define BUTTON_PIN 2 // Pin digital 2 para el botón
int main() {
// Configurar el pin del LED como salida
DDRD &= ~(3 << PORTD2); //D2 yD3 configurados como salida
DDRB |= (1<<PORTB5);
DDRC |= (1<<PORTC2);
// Configurar el pin del botón como entrada con resistencia pull-up
PORTD &= ~(3 << PORTD2);
PORTB &= ~(1<<PORTB5);
PORTC &= ~(1<<PORTC2);
while(1){
if ((PIND & (1 << PD2))) { //Se preciono el boton 1
while(!(PIND & (1 << PD3))){
PORTB |= (1<<PORTB5);
Delay(100);
PORTB &= ~(1<<PB5);
Delay(100);
}
}
}
return 0;
}