I'm having issues with my input pin reads. I have been using booleans but have also tried giving the direct 'digitalRead' statements as well. My readings are inconsistent with the programing, or more likely the programing is off.
I am reading microswitches. 5vdc through 510ohm resistor when open. 0vdc when closed. I have tried the input pins with and without pullups and pulldowns.
RE: booleans = a very simplified version:
with input pin set to 4, and output 13.
} // end of loop
digitalRead((switchPin) == HIGH)
digitalRead((switchPin) == LOW)
if for example I make the pin low, nothing happens. if I make the pin high both register even through the switchOpen is only supposed to read low. When I have used the (!switchClosed()) or (!switchOpen()) they never register. Things only seem to show up when the ! is not used and when the pin is high. The problem is that i can only get one reading for some reason. I do need both for the application I have.
I have also try hooking the input pin to ground and then to the 5vdc on board to see if I can register a change. Also tried the pullups. Is my programming off? I have tried on alternative pins in the chance the one used was burnt out for some reason.