So im not sure why but this code isn't working with mysetup.
I have the signal pin from the PIR sensor conneted to pin8 and the relay signal wire connected to pin7.
The relay and PIR sensor are wired to 5v and Gnd.
/* Arduini PIR Motion Sensor Tutorial
*
* by Dejan Nedelkovski, www.HowToMechatronics.com
*
*/
int pirSensor = 8;
int relayInput = 7;
void setup() {
pinMode(pirSensor, INPUT);
pinMode(relayInput, OUTPUT);
}
void loop() {
int sensorValue = digitalRead(pirSensor);
if (sensorValue == 1) {
digitalWrite(relayInput, LOW); // The Relay Input works Inversly
}
}