While making a project with an electron, with a sensor switch connected to D2 (pulled low by my code), I’ve noticed that when I connect a wire to that pin on a breadboard, with nothing connected to the other end of the wire, it will often cause the pin to briefly go high.
I have the same project in the field, and it has recently given me a series of notifications based on the status of this pin - it performs an interrupt on change. The pin was high due to a closed switch, and it repeatedly sent a notification triggered by the interrupt on D2. However, the data that came with the notification (which reads and transmits the pin state) never showed a change, told me 4 times in a row that the pin status was high - though you’d expect the status to change with each subsequent notification since it only interrupts on change of state.
I’m thinking that the behavior is caused by static electricity, a lightning storm in the vicinity - the project is on a hill in the desert.
My current plan is to implement some sort of debounce code to prevent this in the future.
Has anyone experienced similar behavior, and if so, how did you solve it?