init
This commit is contained in:
commit
81bf9c23a0
|
@ -0,0 +1,27 @@
|
||||||
|
This code is released under the DWTW license
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under the terms of the Do What Thou Wilt License.
|
||||||
|
|
||||||
|
Boundless Public License
|
||||||
|
DO WHAT THOU WILT
|
||||||
|
TO PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 2.55
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it in full or in part is allowed without any restrictions.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. Do what thou wilt shall be the whole of the Law.
|
||||||
|
|
||||||
|
DWTWL – a license with a single requirement: DO WHAT THOU WILT
|
||||||
|
|
||||||
|
The license provides more freedom than any other one (such as GPL or BSD) and does not require saving the license text on copying.
|
||||||
|
|
||||||
|
DWTWL – an accomplished and eligible license for free text, code and any other symbols (including the software, documentation and artwork).
|
||||||
|
|
||||||
|
The license does not contain a "no warranty" clause. DWTWL can be used in countries that do not legally acknowledge the transition to public domain.
|
||||||
|
|
||||||
|
Summary:
|
||||||
|
|
||||||
|
An author-creator gives their source code to the world for free, without becoming distracted by worldly thinking regarding how and why the others will use it.
|
|
@ -0,0 +1,4 @@
|
||||||
|
Arduino nano, Motion sensor and Relay with transformerless power supply
|
||||||
|
======
|
||||||
|
|
||||||
|
![motionsensorrelay](https://dev.ussr.win/microcontrollers/motionsensorrelay/raw/branch/master/motionsensorrelay_bb.jpg)
|
Binary file not shown.
|
@ -0,0 +1,24 @@
|
||||||
|
const int lightDelay = 90000;
|
||||||
|
const byte movePin = 3;
|
||||||
|
const byte relayPin = 4;
|
||||||
|
long lastmoveMillis = 0;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(movePin, INPUT);
|
||||||
|
pinMode(relayPin, OUTPUT);
|
||||||
|
digitalWrite(relayPin, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
if (digitalRead(movePin) == 1) lastmoveMillis = millis();
|
||||||
|
delay(100);
|
||||||
|
if (lastmoveMillis > 0) activateRelay();
|
||||||
|
}
|
||||||
|
|
||||||
|
void activateRelay() {
|
||||||
|
if ((millis() - lastmoveMillis) < lightDelay) digitalWrite(relayPin, LOW);
|
||||||
|
if ((millis() - lastmoveMillis) > lightDelay) {
|
||||||
|
digitalWrite(relayPin, HIGH);
|
||||||
|
lastmoveMillis = 0;
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 110 KiB |
Loading…
Reference in New Issue