Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define PIR_MOTION_SENSOR 2//Use pin 2 to receive the signal from the module
- #define led 13
- #include <Wire.h>
- #include "rgb_lcd.h"
- rgb_lcd lcd;
- const int colorR = 20;
- const int colorG = 20;
- const int colorB = 20;
- void setup()
- {
- pinMode(PIR_MOTION_SENSOR, INPUT);
- Serial.begin(9600);
- pinMode(led, OUTPUT);
- lcd.begin(16, 2);
- lcd.setRGB(colorR, colorG, colorB);
- delay(1000);
- }
- void loop()
- {
- if(digitalRead(PIR_MOTION_SENSOR))//if it detects the moving people?
- lcd.println("ALARM");
- else
- lcd.println("Watching");
- delay(200);
- if(PIR_MOTION_SENSOR == HIGH);
- led, HIGH;
- lcd.setCursor(0, 1);
- // print the number of seconds since reset:
- delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement