Hey guys, please help me with my school project

this error message keeps showing up

fatal error: utility/Adafruit_PWMServoDriver.h: no such file or directory

here is the code:-

#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver"
#include <Wire.h>
#define trigPin 12 
#define echoPin 13
Adafruit_DCMotor MOTOR1(1, MOTOR12_64KHZ);
Adafruit_DCMotor MOTOR2(2, MOTOR12_8KHZ);

void setup() {
 Serial.begin(9600);
 Serial.println("Motor test!");
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
 motor1.setSpeed(105);
 motor2.setSpeed (105);
}

void loop() {

 long duration, distance;
 digitalWrite(trigPin, LOW);
 delayMicroseconds(2);
 digitalWrite(trigPin, HIGH);

 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);
 distance = (duration / 2) / 29.1;
 if (distance < 25) { /*if there's an obstacle 25 centimers ahead, do the following: */
   Serial.println ("Close Obstacle detected!" );
   Serial.println ("Obstacle Details:");
   Serial.print ("Distance From Robot is " );
   Serial.print ( "distance");
   Serial.print ( " CM!");

   Serial.println (" The obstacle is declared a threat due to close distance. ");
   Serial.println (" Turning !");
   motor1.run(FORWARD);
   motor2.run (BACKWARD);
   pinMode(14, OUTPUT);
   digitalWrite(13, HIGH);
   delay(1000);
   digitalWrite(13, LOW);
   delay(1000);
 }
 else {
   Serial.println ("No obstacle detected. going forward");
   delay (15);
   motor1.run(FORWARD); 
   motor2.run(FORWARD);
 }





}

this error message keeps showing up

fatal error: utility/Adafruit_PWMServoDriver.h: no such file or directory

So quit trying to use it.

You have obviously not downloaded the required library or, if you did, you did not install it correctly.

You also clearly did not read the how-to-post-in-this-forum threads at the top of the forum.

I give you a failing grade for this post.

Please read this:-
How to use this forum
Because your post is breaking the rules.

But at least he told us it was a school project!!

Weedpharma

kk, guys go easy on me cuz im only 12, anyway what do you guys recommend that I do?

anyway what do you guys recommend that I do?

Download the library. Install it properly.

thx guys, you've all earnt karma points from me (if that even matters)! anways thx guys and iou guys

wtf! different error

fatal error: utility/Adafruit_PWMServoDriver

#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver"

Why do these two lines use different delimiters around the file names?

ive tried using <> and "" and it still doesn't work

GumdropGary364:
ive tried using <> and "" and it still doesn't work

Where exactly are the library files installed ?
What is the name of the folder ?
What files are in the folder ?
<> and "" have different meanings when used with #include. <> means that the library folder has exactly the same name as the .h file and that the folder is in the libraries folder of your sketches folder. "" means that the .h file referred to in the #include is in the same folder as the program.

Which is it in your case ?

please download this library and have a look, seriously plz look, download adafruit motor shield v2

GumdropGary364:
please download this library and have a look, seriously plz look, download adafruit motor shield v2

Where from?

Hi,
I'm having problems as well, where did you get the sketch from?

Tom... :slight_smile:

GumdropGary364:
please download this library and have a look, seriously plz look, download adafruit motor shield v2

and the answers to my questions are ....... ?

To start with this
#include "utility/Adafruit_PWMServoDriver"will not work because it is not telling the compiler which file to include.

Hi,
Can you repost your code using code tags as in.

They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Thanks mate....Tom..... :slight_smile:

I got the sketch from Roy Pe'er in his obstacle avoiding robot

and you can download the library from sketch>include library>manage libraries and then search up adafruit motor then choose v2 not v1

Done Tom

Hi,
I just downloaded the sketch and it is not the sketch you posted in your first post.

Tom... :slight_smile:

/* Code Written by Roy Pe'er. I've explained all the code in the grey comments.
I recommend you to go over the code, examine it, play with it, improve it and modify it according to your needs. 
For more awesome videos, subsrice to my channel:
http://www.youtube.com/subscription_center?add_user=Roypeer1
*/





#include <AFMotor.h> //import your motor shield library
#define trigPin 12 // define the pins of your sensor
#define echoPin 13 
AF_DCMotor motor1(1,MOTOR12_64KHZ); // set up motors.
AF_DCMotor motor2(2, MOTOR12_8KHZ);
 
void setup() {
  Serial.begin(9600); // begin serial communitication  
  Serial.println("Motor test!");
   pinMode(trigPin, OUTPUT);// set the trig pin to output (Send sound waves)
  pinMode(echoPin, INPUT);// set the echo pin to input (recieve sound waves)
  motor1.setSpeed(105); //set the speed of the motors, between 0-255
motor2.setSpeed (105);  
}
 
void loop() {

   long duration, distance; // start the scan
  digitalWrite(trigPin, LOW);  
  delayMicroseconds(2); // delays are required for a succesful sensor operation.
  digitalWrite(trigPin, HIGH);

  delayMicroseconds(10); //this delay is required as well!
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;// convert the distance to centimeters.
  if (distance < 25)/*if there's an obstacle 25 centimers, ahead, do the following: */ {   
   Serial.println ("Close Obstacle detected!" );
Serial.println ("Obstacle Details:");
Serial.print ("Distance From Robot is " );
Serial.print ( distance);
Serial.print ( " CM!");// print out the distance in centimeters.

Serial.println (" The obstacle is declared a threat due to close distance. ");
Serial.println (" Turning !");
    motor1.run(FORWARD);  // Turn as long as there's an obstacle ahead.
    motor2.run (BACKWARD);

}
  else {
   Serial.println ("No obstacle detected. going forward");
   delay (15);
   motor1.run(FORWARD); //if there's no obstacle ahead, Go Forward! 
    motor2.run(FORWARD);  
  }  
  
  

  
  
  
 
}

what exactly should I do?