I’ve just wasted about 2 hours trying to figure out why a digitalRead() was showing LOW when it should not have been.
I’m making a model train turntable and I have a few simple contacts to identify where it is. In the test program it should only stop briefly when it makes contact, but it was stopping randomly. It seemed to have been working fine last night.
Eventually, after suspecting cross-talk from the stepper wires (28Byj-48) and an inadequate pull-up resistor, and faulty code and goodness knows what else it finally dawned on me that contact was being made through the aluminium covering on the baseboard (Celotex) that had been pierced by a screw holding down one of the contacts.
Of course then there is the satisfaction of beating the bugger