Hello everyone. Let me start by saying that I'm new to Arduino and am hoping to get help with an issue I'm having. I'm attempting to use a button to start a sketch. I have created the code below to for an 8 Channel relay to sequence through using a button to start the sketch. However, when I try to compile the code I get the following error: Error compiling for board Arduino/Genuino Uno.
#include <Button.h>
Button button = Button(12,PULLUP);
const int relay1 = 2;
const int relay2 = 3;
int LightON = 5000;
int Pause = 1000;
void setup()
// put your setup code here, to run once:
{
Serial.begin(9600);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
}
void loop()
{
// put your main code here, to run repeatedly:
if(button.uniquePress(){//button.isPressed() will cause the code to execute as long as button is pressed
digitalWrite(relay1, HIGH); //Turn relay 1 OFF
digitalWrite(relay2, HIGH); //Turn relay 2 OFF
Serial.println("Relays OFF");
delay(Pause);
digitalWrite(relay1, LOW); //Turn relay 1 ON
Serial.println("Relay 1 ON");
delay(LightON);
digitalWrite(relay1, HIGH); //Turn relay 1 OFF
Serial.println("Relay 1 OFF");
delay(Pause);
digitalWrite(relay2, LOW); //Turn relay 2 ON
Serial.println("Relay 2 ON");
delay(LightON);
digitalWrite(relay2, HIGH); //Turn relay 2 OFF
Serial.println("Relay 2 OFF");
delay(Pause);
}
}
Please help! thank you in advance!