I have just bought an Arduino UNO R3 and I'm trying to get a small LED to blink every other second. But each time I try to verify or upload the code, I get the same error: "Error compiling for board Arduino/Genuino Uno". I have selected the correct board and port, and I have connected the LED correctly. 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.
undefined reference to `setup'
is part of it.
Rename setUp
to setup
and it will compile.
See Arduino TUTORIALS > Built-In Examples > 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.
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/
The IDE cannot find your Setup function, that's the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.