Hi all,
Since a long time i started another project, involving a 3VDC motor, triggered by the PIR sensor.
Ive connected it using a test code, and i see it is working well in the Monitor.
Now, for my project i am using a code which ive not written, but i sort of understand (im not yet very knowledgable in the programming part..)
So i know the sensor works, and my eventual code uses different pins on the Uno, but i cant figure out whats wrong here..
the code is this one:
const int pirPower = 13;
const int pirIn = 12;
int motorPin1 = 3;
void setup(){
pinMode(pirPower, OUTPUT);
pinMode(pirIn, INPUT);
pinMode(motorPin1, OUTPUT);
digitalWrite(motorPin1, LOW);
digitalWrite(pirPower, HIGH);
}
void loop(){
int value= digitalRead(pirIn);
if (value == HIGH){
digitalWrite(motorPin1, HIGH);
delay(500);
digitalWrite(motorPin1, LOW);
}
}
now the PIR sensor is on 12, 13, and GND, and does absolutely nothing..
Ive seen the YT video of the guy writing out this code and using the exact same pins and he has no problems at all..
Any help is great help! Thanks in advance!