用Tinkercad学arduino之 人体红外检测报警 LCD显示
项目地址:https://www.tinkercad.com/things/cz2cdSN3EFS-pir-sensor-with-lcd-display
- #include <LiquidCrystal.h>
- LiquidCrystal lcd(12,11,7,6,5,4);
- void setup()
- {
- Serial.begin(9600);
- lcd.begin(16,2);
- pinMode(8,INPUT);
- }
- void loop()
- {
- int a = digitalRead(8);
- Serial.println(a);
- if(a==1)
- {
- lcd.setCursor(2,0);
- lcd.print("Thief Detected");
- delay(2000);
- lcd.clear();
- }
- else
- {
- }
- }