You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
what do you mean "return 1" -- do you mean the pin value is 1? set() doesn't return anything...
Set is defined as:
def set(pin, value):
'''set the pin value to 0 or 1'''
value = int(bool(value))
...
Both gpio.IN and gpio.OUT are "truthy" in python, which is why it is always one.
There could be an assertion that makes sure the value is 0 or 1 instead of the int(bool(value)) that is going on -- although that is a breaking change so I don't think I'm interested in it.
Output
To set the output state of a GPIO pin:
GPIO.output(channel, state)
(where channel is the channel number based on the numbering system you have specified (BOARD or BCM)).
State can be 0 / GPIO.LOW / False or 1 / GPIO.HIGH / True.
Your set() and output() functions do not work correctly when using gpio.HIGH and gpio.LOW. At least document that these functions only work when using True or False.
Using True and False works correctly.
The text was updated successfully, but these errors were encountered: