Go Down

Topic: Ultrasonic 2 Wheel Drive Robot Issues (Read 39 times) previous topic - next topic

RobertJames1265

I have a ARDUINO Ulatrsonic 2 Wheel Drive Robot but the same error seems to come up in every piece of code i get off the internet.

This error is as follows:
AF_DCMotor' does not name a type

The code i am using is:
AF_DCMotor Motor1(1);
AF_DCMotor Motor2(3);

void setup()
{
}

void loop()
{
    Motor1.setSpeed(255);
    Motor2.setSpeed(255);
    Motor1.run(FORWARD);
    Motor2.run(FORWARD);
    delay(1000);
    Motor1.run(BACKWARD);
    Motor2.run(BACKWARD);
    delay(1000);
    Motor1.run(FORWARD);
    Motor2.run(BACKWARD);
    delay(1000);
    Motor1.run(BACKWARD);
    Motor2.run(FORWARD);
    delay(1000);
    Motor1.setSpeed(0);
    Motor2.setSpeed(0);
    Motor1.run(BRAKE);
    Motor2.run(BRAKE);
    delay(1000);
}

If anyone can be of use to assist me that would be extremely helpful and apprecialed

Thankyou

J-M-L

#1
Jul 20, 2019, 09:53 am Last Edit: Jul 20, 2019, 09:56 am by J-M-L
Chances are that You did not install the  AF_DCMotor class/library (obsolete) nor #include it in the code

And You definitely did not read how to post here.

Please correct your post
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

Go Up