rioboard.ReadDigitalInput(1) is always the one?

5 years 8 months ago #29530287 by mjepson
No matter which Input connection I wire to +5V, only
rioboard.ReadDigitalInput(1)
will return 1. All other values for 'ch' will result in a 0.
When I call
rioboard.ReadAllDigitalInputs()
I get a meaningful mask, which I have used to fix it myself, like so:
def read_digital_input(index):
    to_find = 2 ** (index - 1)
    mask = rioboard.ReadAllDigitalInputs()
    return (mask & to_find) > 0

But why doesn't ReadDigitalInput(ch) work as expected?

Please Log in or Create an account to join the conversation.

Time to create page: 0.150 seconds