Pin

This class can be used to read and control the two logic pins on pins 5 and 6 of each port. You can access two Pin objects via each Port instance if the port has been set to MODE_GPIO mode.

class Pin

Control a general purpose input/output (GPIO) pin.

direction(direction: Optional[int])int

Gets and sets the direction of the pin.

Parameters

direction – Choose 0 to make the pin an input or 1 to make it an output.

Returns

The configured direction.

value(value: Optional[int])int

Gets and sets the logic value of the pin.

Parameters

value – Choose 1 to make the pin high or 0 to make it low. If the pin is configured as an input, this argument is ignored.

Returns

Logic value of the pin.