Why Does My Loop Run Too Fast?

The loop runs as fast as the microcontroller can execute your code. If you want it slower, you must add timing.

The simplest fix

Add a delay:

loop_with_delay.ino
cpp
void loop() {
  // your code
  delay(100);
}

Better timing with millis

Use millis for non blocking timing:

loop_with_millis.ino
cpp
unsigned long last = 0;
void loop() {
  if (millis() - last >= 100) {
    last = millis();
    // run code
  }
}
Bottom line

Loops are fast by default. Add delay or millis based timing to slow them down.

Related: Why does my code compile but not work? · How do I use Serial Monitor correctly? · What does this error message mean?