error: expected initializer before 'void'


whenever try compile code following error : 'error: expected initializer before 'void''
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

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

CPU load monitoring using GPIO and leds - Raspberry Pi Forums