Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- // -------------------------------------------
- // Program Sederhana Sensor PIR
- // www.ardukode.blogspot.com
- // -------------------------------------------
- int ledPin = 13;
- int pirPin = 2;
- void setup() {
- pinMode(ledPin, OUTPUT);
- pinMode(pirPin, INPUT);
- }
- void loop() {
- int pirValue = digitalRead(pirPin);
- if (pirValue == HIGH) {
- digitalWrite(ledPin, HIGH);
- } else {
- digitalWrite(ledPin, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement