Having problems with the libraries in the ESP32 controller

shows me the following error and this is even though I have the library installed.
I don't know what to do and it's very frustrating.
please help me

C:\Users\vitoa\AppData\Local\Temp.arduinoIDE-unsaved2024216-8856-15jmuxl.nn4x\sketch_mar16a\sketch_mar16a.ino:1:10: fatal error: ESP32Servo.h: No such file or directory
#include <ESP32Servo.h>
^~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: ESP32Servo.h: No such file or directory

#include <ESP32Servo.h>

Servo myservo;  // Creating a servo object

int servoPin = 22; // Pin for servo connection

void setup() {
  myservo.attach(servoPin);  // Attaching the servo to the pin
  myservo.write(0); // Initial position at 0 degrees
  delay(1000); // Delay for 1 second
}

void loop() {
  // Rotate servo to 90 degrees
  myservo.write(90);
  delay(1000); // Delay for 1 second
  
  // Rotate servo back to 0 degrees
  myservo.write(0);
  delay(1000); // Delay for 1 second
}

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

This is the easiest way to tidy up the code and add the code tags

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Exactly which board have you got selected in the IDE ?

Welcome to the forum.

I hope that your Arduino files are still okay, or else you have to uninstall it and remove everything (but not your projects) and install it again.

Which Arduino board have you selected ?
I tried the "ESP32 Dev Module".

Do you use the Arduino IDE 2.3.2 (the newest version at the moment) ?
Click in the left bar on the icon for the libraries and check the ESP32Servo library.
I have this one:
afbeelding

Do you know where your projects are ?
Go to menu: File / Preferences
Look at the "Sketchbook location".
Go there, and go into the "libraries" folder. Then find the "ESP32Servo" folder and check if the library files are in the "src" folder.

ESP32 Dev Module

Hi Koepel

thank you for your response

Yes I am using the latest version and we are also using the same library.
The location of the library is correct according to what you described

I'm wondering, does the fact that my folders are located in a folder that is shared with OneDrive have an effect?

Thanks

Long long time ago, the Arduino IDE did not work with online drives and had trouble with a project divided over different drives. It is possible that your OneDrive settings causes the trouble.

I don't know what else it could be. It compiles on my computer.

Hi @vito_a. I'm going to ask you to post the full verbose output from a compilation.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Check the box next to "Show verbose output during: ☐ compilation" in the "Preferences" dialog.
  3. Click the "OK" button.
    The "Preferences" dialog will close.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to fail.
  6. You will see a "Compilation error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  7. Open a forum reply here by clicking the "Reply" button.
  8. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block icon on toolbar
  9. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the compilation output into the code block.
  10. Move the cursor outside of the code block markup before you add any additional text to your reply.
  11. Click the "Reply" button to post the output.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here:

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a forum reply here by clicking the "Reply" button.
  5. Click the "Upload" icon (Upload icon) on the post composer toolbar:
    Upload icon on toolbar
    The "Open" dialog will open.
  6. Select the .txt file you saved from the "Open" dialog.
  7. Click the "Open" button.
    The dialog will close.
  8. Click the "Reply" button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.