Please see attached error message. We are using Mega 2560 and are attempting lesson #10 Ultrasonic Sensor Module. We have exhausted all avenues to resolve the error. We are able to follow the instructions without issue for all of the preceding lessons. We are very new to this, so any guidance would be greatly appreciated.
That usually means that the library is not correctly installed.
Read the how to use this forum-please read sticky to see how to properly post code and errors and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.
The library is included with the rest of the files for your Elegoo kit. You can install it like this:
- (In the Arduino IDE) Sketch > Include Library > Add .ZIP library
- Select English/libraries/HC-SR04.zip from the files provided by Elegoo.
- Click the "Open" button.
After that, your sketch should now compile.
You can use the same process to install other libraries as they are needed.
Remember to re-start the IDE so that it can find the newly installed library.
It's not necessary to restart the Arduino IDE if you use the "Add .ZIP Library" or "Manage Libraries" installation methods.
In fact, if you're using a modern version of the Arduino IDE, it's not even necessary to restart the Arduino IDE after doing a manual installation of a library (which I would recommend against for any beginner since the other library installation methods will make sure the installation is done correctly). The only reason you might still want to restart after a manual library installation is to get the library's examples to show up under the File > Examples menu (which is not necessary in this case), or for the library to show up under the Sketch > Include Library menu (which is also not necessary in this case).