Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int pinSensor =7;
- int pinState=0;
- void setup() {
- Serial.begin(9600);
- pinMode(pinSensor, INPUT);
- }
- void loop() {
- pinState=digitalRead(pinSensor);
- //if pir state is high then motion is detected
- if (pinState==HIGH){
- Serial.println("Motion Detected");
- delay(100);
- }else{
- Serial.println("No Motion Detected");
- delay(100);
- }
- }
Add Comment
Please, Sign In to add comment