This is driving me nuts!
We have a "directional" door buzzer on the front door at work. It's a handful of relays and a timer that works with two sets of IR beams aimed across the door.
Basically, when you walk IN (beam1 followed by beam2) the buzzer sounds until we reset it by pushbutton.
When you walk OUT (beam2 followed by beam1) there is no alarm.
I thought I would replace the rats nest of relays with a Picaxe.
The code below does what I want BUT if two people exit one after the other, the buzzer sounds and it shouldn't.
What is happening is that the first person going out trips beam2 then beam1 - this is ok. Then when the second person exiting trips beam2 the buzzer incorrectly sounds because the previous person had of course tripped beam1 on their way out and "primed" the circuit to trigger on the next activation of beam2.
Two people exiting (beam2, beam1, beam2, beam1) should not sound the buzzer.
The only thing I can think of is perhaps to flag the last trigger of beam2 and ignore a "beam1, beam2" sequence if the beam2 flag is set.
Trouble is, that's beyond my basic Basic skills.
This is the working code. Works great if only one person exits though.
'18X
'Directional door buzzer nov05
'Beam1 then beam2 = buzzer
'Beam2 then beam1 = no buzzer
'Beam2 then beam1 then beam2 then beam1 = buzzer (wrong)
symbol beam1 = pin2
symbol beam2 = pin0
symbol reset_sw = pin7
main:
if beam1 = 1 then timer
goto main
timer:
if beam2 = 1 then buzzer
if reset_sw = 1 then turnoff
goto timer
buzzer:
high 0
if reset_sw = 1 then turnoff
goto buzzer
turnoff:
low 0
if reset_sw = 1 then turnoff
goto main
We have a "directional" door buzzer on the front door at work. It's a handful of relays and a timer that works with two sets of IR beams aimed across the door.
Basically, when you walk IN (beam1 followed by beam2) the buzzer sounds until we reset it by pushbutton.
When you walk OUT (beam2 followed by beam1) there is no alarm.
I thought I would replace the rats nest of relays with a Picaxe.
The code below does what I want BUT if two people exit one after the other, the buzzer sounds and it shouldn't.
What is happening is that the first person going out trips beam2 then beam1 - this is ok. Then when the second person exiting trips beam2 the buzzer incorrectly sounds because the previous person had of course tripped beam1 on their way out and "primed" the circuit to trigger on the next activation of beam2.
Two people exiting (beam2, beam1, beam2, beam1) should not sound the buzzer.
The only thing I can think of is perhaps to flag the last trigger of beam2 and ignore a "beam1, beam2" sequence if the beam2 flag is set.
Trouble is, that's beyond my basic Basic skills.
This is the working code. Works great if only one person exits though.
'18X
'Directional door buzzer nov05
'Beam1 then beam2 = buzzer
'Beam2 then beam1 = no buzzer
'Beam2 then beam1 then beam2 then beam1 = buzzer (wrong)
symbol beam1 = pin2
symbol beam2 = pin0
symbol reset_sw = pin7
main:
if beam1 = 1 then timer
goto main
timer:
if beam2 = 1 then buzzer
if reset_sw = 1 then turnoff
goto timer
buzzer:
high 0
if reset_sw = 1 then turnoff
goto buzzer
turnoff:
low 0
if reset_sw = 1 then turnoff
goto main
Last edited by a moderator: