AFMotor.h: No such file or directory

Hey guys I'm a starter and have no idea what I'm doing and I'm new to forums so... I tried making the obstacle avoiding robot but i cant upload the code this things shows up:-

Arduino: 1.8.9 (Windows 10), Board: "Arduino/Genuino Uno"

ArduinoRobot:7:21: error: AFMotor.h: No such file or directory

compilation terminated.

exit status 1
AFMotor.h: No such file or directory

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

1 Like

@Tectonic1900 please don't hijack threads. I've had to split your post out to a separate thread.

Tectonic1900:
ArduinoRobot:7:21: error: AFMotor.h: No such file or directory

When you see a "No such file or directory" error it almost always means you need to install the library that contains the missing file.

Often the code you're compiling will come with documentation (either a comment or separate document) that tells you where to get the library dependencies.

In other cases the author of the code will not have been so kind and you'll need to go on a hunt for the missing library.

A good place to start is the Arduino IDE's Library Manager:

  • Sketch > Include Library > Manage Libraries...
  • In the "Filter your search..." box, type some keywords you have gleaned from the missing file name.
  • Scroll through the results for the right library. Click on it.
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".
  • Try compiling your code again.

If you have no luck in Library Manager then load up your favorite search engine and do a search for the missing filename. You will often get multiple results. If you have a lot of results you might add "arduino" as an additional search keyword. I will usually prefer results on github.com since that is where most Arduino libraries are hosted and downloading from there is fast and easy. In some cases there will be multiple libraries that contain the given filename and you'll need to do some evaluation to determine which seems the most appropriate, then try it out. After downloading the library you found you'll need to install it. This requires a different process than the Library Manager installation. You will find instructions here:

Sry about that it worked only to bring up this :- thx for the help but need it again

Arduino: 1.8.9 (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 3742 bytes (11%) of program storage space. Maximum is 32256 bytes.
Global variables use 83 bytes (4%) of dynamic memory, leaving 1965 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\.\COM7": The system cannot find the file specified.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Make sure you have selected the port of your Arduino board from the Tools > Port menu.

Sometimes the port will be labeled with the board name in the menu. Other times it will not. If you don’t know which port is your Arduino, you can find it like this:

  • Unplug your Arduino board from the computer.
  • Tools > Port
  • Note the ports, if any, listed in the menu.
  • Close the Tools menu
  • Plug your Arduino board into the computer.
  • Tools > Port - The new port listed in the menu is your Arduino board.

thx my arduino is fried I mean it worked the code was uploaded then my board gave sound like a buzz and I saw smoke coming out of it :frowning: :frowning: thx for helping anyway

I concur with your diagnosis.

The next thing you need to do is analyze your circuit to determine why the Arduino was fried.

Although they aren't much fun at the time, "magic smoke" incidents are an inevitable part of the learning process. The essential thing is to treat them as an opportunity to learn. If you don't learn from your mistakes then you'll continue to repeat them, and when each of those repeated mistakes costs you an Arduino that could get expensive after a while.

the board is not dead I tried turning on the power again and the bot didnt move but listened carefully it is beeping every few seconds

I can send you a mp4 file but it is way bigger than 2 mb so can i gmail that to you

I'll pass.

I can send you a mp 4 file but it is way bigger than 2 m b so can i gmail that to you

I'll pass.

Ok is there anything you or I can do??

I already told you what you need to do next:

pert:
The next thing you need to do is analyze your circuit to determine why the Arduino was fried.

Did you do that?

Thx pert for wasting your time on me the robot worked! I found out that I was giving way too much power to it (9v exactly) so even if the board got fried there it is the reason for it to happen now I need to make the servo and the distance sensor work too..