WeMOS: D1 R1 mini PIR Sensor

From OnnoWiki
Revision as of 11:38, 25 April 2024 by Onnowpurbo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sumber: http://www.esp8266learning.com/wemos-mini-pir-sensor-example.php

PIR Interfacing Diagram2.png
Wemos-and-PIR bb-1024x612.png

Source

int pirPin = D7;
int val;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  val = digitalRead(pirPin);
  //low = no motion, high = motion
  if (val == LOW)
    Serial.println("No motion");
  else
    Serial.println("Motion detected  ALARM");
  delay(1000);
}


Referensi

Pranala Menarik