Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/interrupt.h>
- #include <avr/delay.h>
- #include <math.h>
- #include <util/delay.h>
- #define F_CPU 1000000L
- ISR(INT0_vect)
- {
- for (int i = 0; i < 5; i++) {
- _delay_ms(10);
- PORTA = 0b11111111;
- _delay_ms(10);
- PORTA = 0b00000000;
- }
- }
- int main(void)
- {
- cli();
- MCUCR = (MCUCR & 0b1111100) | 0b10;
- GIMSK |= (1<<INT0);
- GICR |= 0b01000000;
- sei();
- while(1)
- {
- _delay_ms(200);
- PORTA = 0b00000001;
- _delay_ms(200);
- PORTA = 0b00000010;
- _delay_ms(200);
- PORTA = 0b00000100;
- _delay_ms(200);
- PORTA = 0b00001000;
- _delay_ms(200);
- PORTA = 0b00010000;
- _delay_ms(200);
- PORTA = 0b00100000;
- _delay_ms(200);
- PORTA = 0b01000000;
- _delay_ms(200);
- PORTA = 0b10000000;
- _delay_ms(200);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement