i need help for my program to controller my motor servo using pir sensor
please help me
i need help for my program to controller my motor servo using pir sensor
What have you done so far? Nothing is the wrong answer.
What is still to be done? Everything is the wrong answer.
#include <Servo.h>
const int PIRPin = 2;
const int ServoPin = 3;
Servo servo;
void setup() {
pinMode(PIRPin, INPUT_PULLUP);
servo.attach(ServoPin);
}
void loop() {
servo.write(digitalRead(PIRPin) ? 0 : 180);
}
There. All done.