help with sensors + dfplayer code
sensors are working, they do play audio once they detect something, but theyre playing the wrong audio assigned to them. i think theres something wrong with my if else statements, like some try to go in a different condition rather than the one theyre supposed to go to?
what im trying to do:
*ir2 active should always stop any audio
*pir2 should override pir1
1. if pir1 active
if IR1 detecting only - play audio 2
if IR2 detecting only - stop
if both IRs detecting - stop
if both IRs not detecting - play audio 1
2. if pir2 active
if IR1 detecting only - play audio 3
if IR2 detecting only → stop
if both IRs detecting → stop
if both IRs not detecting → play audio 3
3. if both pir1 and pir2 active
if IR1 detecting only - play audio 3
if IR2 detecting (or both) - stop
no ir detecting - play audio 3
4. if both pirs inactive
do nothing
what happens:
ir1+pir1 plays audio 3 (shouldnt do that)
pir2 plays audio 1 (shouldnt do that, it should only ever play audio 3 or not play at all)
pir1 itself plays audio 2 (it should only play audio 1 on its own, it should only play audio 2 if its triggered along with ir1)
code (it automatically sends in txt) and circuit:
0 Replies