Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #= SeCoDoLa = v0.1 =================== by swagman =#
- # __ __ ___ _ #
- # / _|___ / _|___ | \ ___ | | __ _ #
- # \_ / -_) | (_/ _ ntrols| |) / _ \ | |_/ _` | #
- # |__\___nsor\__\___rridor|___/\___ors&___\__,_mps #
- #==================================================#
- # + Automatic control of lighting and doors in
- # corridors or rooms with one or two entrances
- # by means of presence (motion) sensors
- # + All devices are optional, i will do what is
- # possible depending on the available devices
- # + If there is a Solar sensor, it will be used
- # the solar sensor must be oriented face down!
- # + Full installation diagram: SDSLLLLLLLLSDS
- # mean: S-motion sensor; D-door; L-lamp
- # + see the video instructions at the link
- #= 2020.00.00 00:00 https://youtu.be/da73flIl_iQ =#
- # + and set lamp hash below
- define lamps -1860064656 #lamp hash (press F1)
- alias Sens1Ot d0
- alias Sens1In d1
- alias Door1 d2
- alias Sens2Ot d3
- alias Sens2In d4
- alias Door2 d5
- alias Count r15
- alias Prev1Ot r14
- alias Prev1In r13
- alias Prev2Ot r12
- alias Prev2In r11
- alias State r10
- move Count 0
- loop:
- move r0 0
- brdns Sens1Ot 2
- l r0 Sens1Ot Activate
- select r2 r0 Prev1In 0
- sub Count Count r2
- move r1 0
- brdns Sens1In 2
- l r1 Sens1In Activate
- select r2 r1 Prev1Ot 0
- add Count Count r2
- move Prev1Ot r0
- move Prev1In r1
- move r0 0
- brdns Sens2Ot 2
- l r0 Sens2Ot Activate
- select r2 r0 Prev2In 0
- sub Count Count r2
- move r1 0
- brdns Sens2In 2
- l r1 Sens2In Activate
- select r2 r1 Prev2Ot 0
- add Count Count r2
- move Prev2Ot r0
- move Prev2In r1
- max Count Count 0
- s db Setting Count
- #---
- or r0 Prev1Ot Prev1In
- brdns Door1 2
- s Door1 Open r0
- or r0 Prev2Ot Prev2In
- brdns Door2 2
- s Door2 Open r0
- #---
- sgtz r0 Count
- lb r1 1076425094 Vertical Minimum
- slt r1 r1 100
- and r0 r0 r1
- breq State r0 2
- sb lamps On r0
- move State r0
- lb r1 lamps On Average
- round r2 r1
- brne r1 r2 3
- xor r2 r2 1
- sb lamps On r2
- yield
- j loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement