/blinkInterrupts.ino Secret
Created
July 19, 2020 18:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ledpin = PORTB5; | |
void setup() { | |
// put your setup code here, to run once: | |
DDRB = _BV(ledpin); | |
TCCR1A = B00000000; //Normal Mode, no automatic pin toggling | |
TCCR1B = _BV(CS12) | _BV(CS10); //Set up x1024 prescaler | |
TIMSK1 = _BV(TOIE1); //Enable overflow interrupt | |
interrupts(); //Enable interrupts globally | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
} | |
ISR(TIMER1_OVF_vect){ //Timer1 Overflow ISR | |
PORTB ^= _BV(PORTB5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment