-
-
Save JeffersGlass/5a7e8e80e1b16d8ec155957587872179 to your computer and use it in GitHub Desktop.
This file contains 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); //Set up LED pin as output | |
Serial.begin(115200); | |
TCCR1A = _BV(COM1A0); //Mode will be CTC; WGM12 is in B register | |
TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10); //Set up x1024 prescaler | |
OCR1A = 0x3333; | |
TIMSK1 = _BV(OCIE1A); //Enable overflow interrupt | |
interrupts(); //Enable interrupts globally | |
} | |
void loop() { | |
} | |
ISR(TIMER1_COMPA_vect){ //Timer1 Comp Interrupt | |
Serial.println("Hello!"); | |
PORTB ^= _BV(ledpin); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment