on-off timings
This commit is contained in:
parent
26e036f8f8
commit
3a039b30c7
25
Scripts/time.js
Normal file
25
Scripts/time.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
inlets = 1
|
||||||
|
outlets = 1
|
||||||
|
|
||||||
|
var lastHour = null;
|
||||||
|
|
||||||
|
var onOffHours = {}
|
||||||
|
|
||||||
|
function bang(){
|
||||||
|
var d = new Date(); // for now
|
||||||
|
var hour = d.getHours();
|
||||||
|
if (hour !== lastHour){
|
||||||
|
lastHour = hour;
|
||||||
|
if (onOffHours[hour]){
|
||||||
|
outlet(0, onOffHours[hour]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function on(hour){
|
||||||
|
onOffHours[hour] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function off(hour){
|
||||||
|
onOffHours[hour] = 0;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user