What about the alternative of glueing a magnet on the flap and placing puck next to it? You may get more uniq readings. If you cat wears a collar, put an RFID tag or magnet on it. If it is a magnet, make it perpendicular to the earth magnet lines. You then also get the direction and not just the flap action. You still can keep track of the state of in and out and compare with the sequence of movements, of which you get going and going out. It's quite a neat problem, since just sticking the head thru the flag is not-entered or not-left yet. I now do not suggest to also glue a magnet onto the tail...
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
What about the alternative of glueing a magnet on the flap and placing puck next to it? You may get more uniq readings. If you cat wears a collar, put an RFID tag or magnet on it. If it is a magnet, make it perpendicular to the earth magnet lines. You then also get the direction and not just the flap action. You still can keep track of the state of in and out and compare with the sequence of movements, of which you get going and going out. It's quite a neat problem, since just sticking the head thru the flag is not-entered or not-left yet. I now do not suggest to also glue a magnet onto the tail...