当我尝试编译此代码时,我在标题中收到错误消息。我是新手,并不确定是否有什么事情完全超出我的想象。这段代码只是为了测试我试图用arduino自动转换的RC车的接线。我之前在这里看到过这个错误信息,但我无法找到将解决方案应用于我的代码的方法。我已经尝试查看所有括号并确保它们彼此配对(例如{},而非{{或}}或} {)。我希望能够通过感恩节假期解决这个问题,所以非常感谢任何帮助。
int driveneg = 9;
int drivepos = 5; /*this shows all my variables*/
int steeringneg = 6;
int steeringpos = 3;
byte speed =255;
void setup ();
{
pinMode (steeringneg, OUTPUT);
pinMode (steeringpos, OUTPUT); /*setting the motors to output*/
pinMode (driveneg, OUTPUT);
pinMode (drivepos, OUTPUT);
}
void loop ();
{
forward();
delay (2000);
backward();
delay (2000);
}
void backward();
{
analogWrite (9,0);
analogWrite (5, speed);/*defines forward and backward functions*/
analogWrite (6, 0);
analogWrite (3, speed);
}
void forward();
{
analogWrite (9, speed);
analogWrite (5, 0);
analogWrite (6, speed);
analogWrite (3, 0);
}
答案 0 :(得分:0)
在函数括号后删除分号(;
),如下所示:
void setup ()
{
...
}