void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(115200);
  // initialize the measurement
  TCCR1B = bit(CS10);
  TCNT1 = 0;
  //digitalWrite(LED_BUILTIN, HIGH);
  // take the measurement
  unsigned int cycles = TCNT1;
  // print the result
  Serial.println(cycles - 1);
}
 
 
void loop() {
  // delay(1000);
  //digitalWrite(LED_BUILTIN, LOW);
  //delay(1000);
}
 

sketch.ino hosted with by Wokwi