const int pushbutton = 2;
const int relay1Pin = 4;
void setup() {
// put your setup code here, to run once:
pinMode(pushbutton, INPUT_PULLUP);
pinMode(relay1Pin, OUTPUT);
digitalWrite(relay1Pin, HIGH);
}
void loop() {
int estadoBoton = digitalRead(pushbutton);
if(pushbutton==HIGH){
digitalWrite(relay1Pin,LOW); // Activate relay.
}else {
digitalWrite(relay1Pin,HIGH); // Release the relay.
}
}