Спойлер
Код: Выделить всё
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/iom16.h>
#define LED_DDR DDRC
#define LED_PORT PORTC
#define LED (1<<1)
#define BTN_DDR DDRD
#define BTN_PORT PORTD
#define BTN (1<<2)
ISR (INT0_vect)
{
//small delay here
BTN_PORT&BTN?LED_PORT &= ~LED:LED_PORT |= LED;
}
int main(void)
{
BTN_DDR &= ~BTN; // Set as input
LED_DDR |= LED; // Set as output
GICR |= (1<<INT0); // Enable INT0
MCUCR &= ~(1<<ISC10); // Any logical change
sei();
while (1) {
}
return 0;
}





