Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #define PIR_MOTION_SENSOR 2//Use pin 2 to receive the signal from the module
  2. #define led 13
  3.  
  4. #include <Wire.h>
  5. #include "rgb_lcd.h"
  6.  
  7. rgb_lcd lcd;
  8.  
  9. const int colorR = 20;
  10. const int colorG = 20;
  11. const int colorB = 20;
  12.  
  13. void setup()
  14. {
  15. pinMode(PIR_MOTION_SENSOR, INPUT);
  16. Serial.begin(9600);
  17.  
  18. pinMode(led, OUTPUT);
  19.  
  20. lcd.begin(16, 2);
  21.  
  22. lcd.setRGB(colorR, colorG, colorB);
  23.  
  24. delay(1000);
  25. }
  26.  
  27. void loop()
  28. {
  29. if(digitalRead(PIR_MOTION_SENSOR))//if it detects the moving people?
  30. lcd.println("ALARM");
  31.  
  32. else
  33. lcd.println("Watching");
  34. delay(200);
  35.  
  36. if(PIR_MOTION_SENSOR == HIGH);
  37. led, HIGH;
  38.  
  39. lcd.setCursor(0, 1);
  40. // print the number of seconds since reset:
  41.  
  42.  
  43. delay(100);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement