Whenever I try to compile this code I get the following error : 'error: expected initializer before 'void''
#include <AFMotor.h>
AF_DCMotor motor1(1, MOTOR12_64KHZ); // create motor #1, 64KHz pwm
AF_DCMotor motor2(2, MOTOR12_64KHZ); // motor #2
void setup()
{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Motor test!");
}
void loop()
{
go();
backup();
halt();
}
void go() {
Serial.println("All motors ahead - fast");
motor1.run(FORWARD);
motor2.run(FORWARD);
motor1.setSpeed(255);
motor2.setSpeed(255);
return;
}
void backup() {
Serial.println("All motors backward - fast");
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor1.setSpeed(255);
motor2.setSpeed(255);
return;
}
void halt()
{
uint8_t i;
for (i=255; i!=0; i--)
{
motor1.setSpeed(i);
motor2.setSpeed(i);
delay(10);
}
Serial.println("All motors stop");
motor1.run(RELEASE);
motor2.run(RELEASE);
return;
}
I am trying to run 2 motors with my arduino through the motor shield from adafruit. Please help me guys!!!!