Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State of output pins is not persistent #55

Open
OrangeTux opened this issue Oct 5, 2014 · 0 comments
Open

State of output pins is not persistent #55

OrangeTux opened this issue Oct 5, 2014 · 0 comments

Comments

@OrangeTux
Copy link

The state of the an output is not persistent. The code below will set GPIO pin 0 to high. I expected the pin to stay high after this little script has finished. But that is not the case. I found out that the value of the pin drops to low when Python leaves the context manager.

When Python leaves the context manager, PinApi.close() is called and this method eventually changes the direction of the pin to input.

from quick2wire.gpio import pins, Out
from time import sleep
with pins.pin(0, direction=Out) as pin:
    pin.value = 1
    sleep(1)
# Pin drops to low.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant