#define RELAY_PIN 22
#define SW 12
void setup()
{
pinMode(RELAY_PIN, OUTPUT);
pinMode(SW, INPUT);
}
void loop()
{
int swip;
swip = digitalRead(SW);
if (swip == HIGH)
{
digitalWrite(RELAY_PIN, HIGH);
delay(1000);
}
else
{
digitalWrite(RELAY_PIN, LOW);
delay(1000);
}
}