I'm sorry but I need a schematic and your
code. I don't know why you are doing a reset
right after wakeup. Also don't know why you aren't
using an interupt to wakeup. To my knowledge
"wakeup" means wakeup, not wakeup and reset.
In addition your schematic and your code we
need your design criteria defining the algorithm
of the code. (in order to verify that the code
you post does what you say it is supposed to do.
(preferably in outline form)
What we need to know is what is connected to
what, in schematic form.(if possible)
If you can't draw then just list the devices and
where each pin goes .
ie:
Q1 2n2904
b: to ....
c _to ....
e__to ....
Then we need the Truth Table:
IF A,
THEN ( do action)
IF B,
THEN (do some other action)
I'm not an alarm expert but in my mind you
only need one trigger to set off an alarm.
Don't wait passively counting the reed switch
triggers. If it triggers once you turn on the siren.
Software is not my area of expertise. I'll look at tge schematic but someone else will have to look at your code.
Looking back over your post from the beginning,
your presentation of the reason you're
posting is all wrong.
The standard procedure is to start at the
BEGINNING , not in the middle of a circuit.
And if you don't know electronics PLEASE
don't try to guess here on the forum.
At any given time of any day there is literally
centuries of experience if you add up the
years of electronics experience of the
forum members reading these posts.
I have 40 years myself and I'm nowhere
near the most knowledgable since I am only a technician and probably 30% or more of the
members are EE engineers. I'm telling you
this because what annoys us the most is
posters trying to guess how to draw a svhematic instead of Googling "transistor driver" or
simply asking "How do you make a circuit
that does this:(explanation)."
Start over. Give us ALL the information
in one post.
1. Project objective
2. schematic (if you can draw it)
3. code
4. Explanation of what you know about the
problem.
5. Your last post is very hard to follow,
especially when you start describing the circuit:
(collector to emitter

?!!!!) ( what the heck does
that mean ?)
If you don't know how to design , don't even try.
Just state you don't know how and want to
know how. Your first schematic was a disaster
but you at least admitted you didn't have a
clue, which, quite frankly, very few posters
have the guts to do.