Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Last active July 19, 2020 22:22
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/2a738a20cbb8fe0ad787376e8603b793 to your computer and use it in GitHub Desktop.
Save JeffersGlass/2a738a20cbb8fe0ad787376e8603b793 to your computer and use it in GitHub Desktop.
int tonepin = PORTB1;
void setup() {
// put your setup code here, to run once:
DDRB = _BV(tonepin); //Set up tone pin as output
TCCR1A = _BV(COM1A0); //Mode will be CTC; WGM12 is in B register
TCCR1B = _BV(WGM12) | _BV(CS11); //Set up x8 prescaler
OCR1A = 0x1000;
interrupts(); //Enable interrupts globally
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment