...I'm baffled... I could understand some bouncing... but that is weird...
What does the data sheet of the switch say about how the magnet should be positioned and moved?
What do you know about the magnet? ...its magnetic field?
falling is definitively the right thing with your circuit setup. Worst case you have to do some 'debouncing' yourself... using fuzzy logic...
In our case you get a rapid sequence of ons and then nothing for a while... if you just take the first one and ignore all others within a particular time frame. Not an elegant solution, but it may work, since you know that it is a wheel that can run only within a particular speed range.
Debouncing is not an easy thing, as other users noticed in their conversations: here (1) and here (2).
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.
...I'm baffled... I could understand some bouncing... but that is weird...
falling
is definitively the right thing with your circuit setup. Worst case you have to do some 'debouncing' yourself... using fuzzy logic...In our case you get a rapid sequence of ons and then nothing for a while... if you just take the first one and ignore all others within a particular time frame. Not an elegant solution, but it may work, since you know that it is a wheel that can run only within a particular speed range.
Debouncing is not an easy thing, as other users noticed in their conversations: here (1) and here (2).