项目地址:https://www.tinkercad.com/things/cz2cdSN3EFS-pir-sensor-with-lcd-display

  1. #include <LiquidCrystal.h>
  2. LiquidCrystal lcd(12,11,7,6,5,4);
  3. void setup()
  4. {
  5. Serial.begin(9600);
  6. lcd.begin(16,2);
  7. pinMode(8,INPUT);
  8. }
  9. void loop()
  10. {
  11. int a = digitalRead(8);
  12. Serial.println(a);
  13. if(a==1)
  14. {
  15. lcd.setCursor(2,0);
  16. lcd.print("Thief Detected");
  17. delay(2000);
  18. lcd.clear();
  19. }
  20. else
  21. {
  22. }
  23. }

 

版权声明:本文为meetrice原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/meetrice/p/14081522.html