Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Created July 19, 2020 18:56
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