Untitled
Anonymous
plain_text
04/01/2024 7:57 AM
440 B
9
Indexable
#define D4 2
void setup()
{
Serial.begin(9600);
pinMode(D4, INPUT);
}
void loop()
{
int pirState = digitalRead(D4);
if (pirState == HIGH)
{
Serial.println("Chuyển động được phát hiện!");
}
else
{
Serial.println("Không có chuyển động.");
}
delay(1000);
}
Editor is loading...
Leave a Comment