Skip to content

State of output pins is not persistent #55

@OrangeTux

Description

@OrangeTux

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions