error: expected initializer before 'void'
whenever try compile code following error : 'error: expected initializer before 'void''
i trying run 2 motors arduino through motor shield adafruit. please me guys!!!!
code: [select]
#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 serial library @ 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 trying run 2 motors arduino through motor shield adafruit. please me guys!!!!
i copied , pasted code. compiled no errors, using arduino-0018. version using? line not like?
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > error: expected initializer before 'void'
arduino
Comments
Post a Comment