Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Created July 19, 2020 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffersGlass/c2c0cd166f761aeafc6d758e0bb728e3 to your computer and use it in GitHub Desktop.
Save JeffersGlass/c2c0cd166f761aeafc6d758e0bb728e3 to your computer and use it in GitHub Desktop.
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