Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/delay.h>
- #define BLINK_DELAY_MS 500
- ISR (INT0_vect){
- // switch pin 0 of PORTB while leaving the rest as is
- PORTB ^= (1 << PORTB5);
- }
- int main (void){
- DDRB |= (1 << DDB5);
- DDRD &= ~(1 << DDD2);
- PORTD |= (1 << PORTD2);
- //set INT0 to trigger on falling edge
- EICRA |= (1 << ISC01);
- //Turns on INT0
- EIMSK |= (1 << INT0);
- //SEt Interrupts
- sei();
- while(1) {
- PORTB ^= 1 << PORTB5;
- _delay_ms(BLINK_DELAY_MS);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement