[英]Keep getting “Error compiling for board Arduino/Genuino Uno” error when uploading code
I have just bought an Arduino UNO R3 and I'm trying to get a small LED to blink every other second.我刚买了一个 Arduino UNO R3,我正试图让一个小 LED 每隔一秒闪烁一次。 But each time I try to verify or upload the code, I get the same error: "Error compiling for board Arduino/Genuino Uno".但每次我尝试验证或上传代码时,我都会收到相同的错误:“为板 Arduino/Genuino Uno 编译错误”。 I have selected the correct board and port, and I have connected the LED correctly.我选择了正确的板子和端口,并且正确连接了 LED。 Any help is appreciated.任何帮助表示赞赏。
Here is the code:这是代码:
void setUp()
{
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
You're missing like 4/5 of the error message.您缺少 4/5 的错误消息。
undefined reference to `setup'对“设置”的未定义引用
is part of it.是其中的一部分。
Rename setUp
to setup
and it will compile.将setUp
重命名为setup
,它将编译。
See Arduino TUTORIALS > Built-In Examples > 01.Basics > BareMinimum请参阅Arduino 教程 > 内置示例 > 01.Basics > BareMinimum
This example contains the bare minimum of code you need for a sketch to compile properly on Arduino Software (IDE): the
setup()
method and theloop()
method.此示例包含在 Arduino 软件 (IDE) 上正确编译草图所需的最少代码:setup()
方法和loop()
方法。
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
You have a typo.你有一个错字。 It needs to be:它需要是:
void setup() {
}
Check this out: https://www.arduino.cc/reference/en/language/structure/sketch/setup/看看这个: https://www.arduino.cc/reference/en/language/structure/sketch/setup/
The IDE cannot find your Setup function, that's the problem. IDE 找不到您的安装程序 function,这就是问题所在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.