#define PIROUT 2
#define Hand 3 //goes to relay ch 1
#define Witch 5 //goes to relay ch 2
#define Skull_L 8
#define Skull_R 9
void setup()
{
Serial.begin(9600);
pinMode(PIROUT, INPUT);
pinMode(Hand, OUTPUT);
pinMode(Witch, OUTPUT);
pinMode(Skull_L, OUTPUT);
pinMode(Skull_R, OUTPUT);
digitalWrite(Hand, LOW);
digitalWrite(Witch, LOW);
digitalWrite(Skull_L, LOW);
digitalWrite(Skull_R, LOW);
}
void loop()
{
if (digitalRead(PIROUT)==HIGH)
{
Serial.println("Some body is here");
digitalWrite(Hand, HIGH);
digitalWrite(Witch, HIGH);
for (int i = 0; i <=10; i++){
Serial.println("Skull L off");
digitalWrite(Skull_L, HIGH);
Serial.println("Skull R on");
digitalWrite(Skull_R, LOW);
delay(500);
Serial.println("Skull L on");
digitalWrite(Skull_L, LOW);
Serial.println("Skull R off");
digitalWrite(Skull_R, HIGH);
delay(500);
digitalWrite(Skull_L, HIGH);
digitalWrite(Skull_R, HIGH);
}
//delay(1000);
} else {
Serial.println("Nothing Detected by PIR Sensor");
digitalWrite(Hand, LOW);
digitalWrite(Witch, LOW);
digitalWrite(Skull_L, LOW);
digitalWrite(Skull_R, LOW);
}
//delay(1000);
}