I am 13 and quite new to Arduino programming. I have just finished programming a project for my Arduino Uno. It is meant to be a bike indicator. Except, when I tried verifying it when I fixed all of the errors, it keeps saying 'Error Compiling'. I have tried uploading other projects to my board and they still work yet JUST this one doesn't. Is there something wrong with my code? Here is my code:
int lButton = 3;
int rButton = 2;
int lLed = 4;
int rLed = 5;
int lButtonState = 0;
int rButtonState = 0;
void setup()
{
pinMode(lButton, INPUT);
pinMode(rButton, INPUT);
pinMode(lLed, OUTPUT);
pinMode(rLed, OUTPUT);
}
void check()
{
lButtonState = digitalRead(lButton);
rButtonState = digitalRead(rButton);
if(lButtonState == HIGH || rButtonState == HIGH)
{
if(lButtonState == HIGH && rButtonState == HIGH)
{
digitalWrite(lLed, HIGH);
digitalWrite(rLed, HIGH);
}
else if(lButtonState == HIGH)
{
digitalWrite(lLed, HIGH);
}
else
{
digitalWrite(rLed, HIGH);
}
}
}
Or is there something wrong with the program? Here is the error message:
Arduino: 1.6.6 (Mac OS X), Board: "Arduino/Genuino Uno"
core/core.a(main.cpp.o): In function main': /Users/tirdadtaherian/Desktop/Documents/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp:46: undefined reference to
loop'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Please help as this is a project I have been thinking of making for a while now and it is very useful for me. Thanks. :).