Serial moniter not working with hc-05 bluetooth module

OK, now we're cooking!

This error is caused by not having the Servo library installed. Because this library comes pre-installed with the classic Arduino IDE, the tutorials you find won't mention anything about needing to install it. But the Arduino IDE 2.x doesn't currently come with any libraries pre-installed. You need to install all of them yourself.

That's very easy to do:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE's menus.
  2. In the "Filter your search..." field, type "servo".
  3. Scroll down through the list of available libraries until you see "Servo by Michael Margolis, Arduino". Click on it.
  4. Click the INSTALL button.
  5. Wait for the installation to finish.

Now you should be able to compile your sketch.