#define sw1 13
#define RELAY1 12
#define RELAY2 11
#define RELAY3 10
void setup() {
// put your setup code here, to run once:
pinMode(sw1, INPUT);
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(RELAY3, OUTPUT);
Serial.begin(9600);
Serial.println("Holl you my fan");
}
bool sw1_val;
void loop() {
// put your main code here, to run repeatedly:
sw1_val=digitalRead(sw1);
if(sw1_val==LOW)
{
digitalWrite(RELAY1, HIGH);
delay(1000);
digitalWrite(RELAY1, LOW);
digitalWrite(RELAY2, HIGH);
delay(1000);
digitalWrite(RELAY2, LOW);
digitalWrite(RELAY3, HIGH);
delay(1000);
digitalWrite(RELAY3, LOW);
return;
}
else{
digitalWrite(RELAY1, LOW);
digitalWrite(RELAY2, LOW);
digitalWrite(RELAY3, LOW);
}
}