About
HowTo's
Hotspots
Products
Reviews
News
Click on the flag below to change the language of the text on these pages.
Stats Box -
pir control relay
HostChoice.net: pir control relay
Posted in: Code | by HostChoice.net | 2017 Sept 26
Arduino Duemilanove
Hello all,
This is the test code for a pir control relay circuit.
Arduino sketch to turn relay on for a set period of time when triggered by a source. In this case, it is a PIR motion sensor.
Thanks!
Code: [Select]
// code 222469357 /* PIRrelay Displays time with leading zeros By: Brian Taylor Date: 2018-06-11 */ // pins for Arduino Duemilanove int irmotionPin = 11; // Pin of IR Motion int relayPin = 13; // Pin of relay // const timeleft = 600; void setup() { // loop from the lowest pin to the highest: Serial.begin(9600); pinMode(relayPin, OUTPUT); digitalWrite(relayPin, LOW); } void loop() { // loop from the lowest pin to the highest: while (digitalRead(irmotionPin) == HIGH){ digitalWrite(relayPin, HIGH);// Turn Relay on for (int hrs = 0; hrs > -1; hrs--) { for (int mins = 5; mins > -1; mins--) { for (int secs = 59; secs > -1; secs--) { Serial.print("Relay timer ON "); if (hrs<10){Serial.print("0");}else{Serial.print("");} Serial.print(hrs); if (mins<10){Serial.print(":0");}else{Serial.print(":");} Serial.print(mins); if (secs<10){Serial.print(":0");}else{Serial.print(":");} Serial.println(secs); delay(1000); } } } } digitalWrite(relayPin, LOW);// Turn Relay off Serial.println("Relay is OFF"); delay(500); }
We at HostChoice.net believe the internet should be fun and safe.
Thank you for choosing HostChoice.net...
code
code Home
pir control relay
BluetoothLCD
lcdkeypad
keyboard encoder
rfid2
rfid
pi.ard.watchdog
DK-bluetooth controlled relay
DK-bluetooth controlled relay
DK-bluetooth controlled relay
DK-bluetooth controlled relay
DK-bluetooth controlled relay
DK-bluetooth controlled relay
bluetooth controlled relay
bluetooth controlled relay
bluetooth controlled relay
hdsp211x
accelerometer
All Rights Reserved. All Images and Programming are
Copyright 2024 by HostChoice.net
.
Site Map