Skip to content

Instantly share code, notes, and snippets.

@rosmianto
Created February 23, 2020 06:54
Show Gist options
  • Save rosmianto/cae9767d3bd23eac6a207878ef2fb088 to your computer and use it in GitHub Desktop.
Save rosmianto/cae9767d3bd23eac6a207878ef2fb088 to your computer and use it in GitHub Desktop.
How to Generate 4MHz clock with Arduino Uno
void setup() {
// put your setup code here, to run once:
TCNT1 = 0;
TCCR1B = B00001001;
TCCR1A = B01000000;
OCR1A = 1; // CLK frequency = 4 MHz
pinMode(9, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment