I want to make my robot to move forward and backward. I've installed AFMotor in the libraries correctly (I think). It was shown under sketch--> Import Libraries--> AFMotor. Here is my code. The error said that : "Delay was not declared in this scope" and all kind of DigitalWrite, HIGH, LOW, etc... are not declare in this scope.
Can someone please help me figure out what is wrong? Did I miss anything?
#include <AFMotor.h>
AF_DCMotor motor1(3); // Motor 1 is connected to the port 1 on the motor shield
AF_DCMotor motor2(5); // Motor 2 is connected to the port 2 on the motor shield
void AllForward() { // Makes the robot go forward
motor1.run(FORWARD); // Motor 1 goes forward
motor2.run(FORWARD); // Motor 2 goes forward
}
void Rotate()
{
motor1.run(BACKWARD); // Motor 1 goes forward
motor2.run(FORWARD); // Motor 2 goes backward
delay(1600); // Time required to rotate
}
FORWARD AND BACKWARD MOTOR
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23910
- Joined: Mon Apr 21, 2008 2:33 pm
Re: FORWARD AND BACKWARD MOTOR
That is not Arduino code. Can you include your entire program inside "code" tags?
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: FORWARD AND BACKWARD MOTOR
Also, what version of the IDE and what operating system you are using.Can you include your entire program
Please be positive and constructive with your questions and comments.