Skip to content

Instantly share code, notes, and snippets.

@davecheney
Created September 1, 2013 04:08
Show Gist options
  • Select an option

  • Save davecheney/6402283 to your computer and use it in GitHub Desktop.

Select an option

Save davecheney/6402283 to your computer and use it in GitHub Desktop.
Experimenting with high frequency PWM output from an Atmel328P.
// the setup routine runs once when you press reset:
void setup() {
pinMode(3, OUTPUT);
pinMode(11, OUTPUT);
TCCR2Af = _BV(COM2A0) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20);
TCCR2B = _BV(WGM22) | _BV(CS20);
OCR2A = 1;
OCR2B = 254;
}
void loop() {
// HiZ>f
// AUX Frequency: 4,005,632 Hz
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment