I have some troubles working with arduino and an IR sensor and I would like to know if you could help me.
This is what I'm doing:
I'm measuring distance with an IR sensor (and it's already working) and here's the logic:
If distance is from 4cm to 8cm:
print "Closed door"
If distance is 0 or bigger than 9cm:
print "Door open"
And here's the thing:
What would happen if the door is open or there is an interference? Like, let's say, my cat passes by and blocks the signal? Then the distance measured would be found between 4 to 8cm...
What I would like to do but haven't been able to is something like "if the measured distance changes rapidly then nothing happened, keep printing the door is open"
That's my problem, could anyone help me?
Thanks in advance!!! ;D