class Pin – control I/O pins¶
A pin is the basic object to control I/O pins. It has methods to set the mode of the pin (input, output, etc) and methods to get and set the digital logic level. For analog control of a pin, see the ADC class.
Usage Model:
Constructors¶
-
class
pyb.
Pin
(id, ...)¶ Create a new Pin object associated with the id. If additional arguments are given, they are used to initialise the pin. See
pin.init()
.
Methods¶
-
pin.
value
([value])¶ Get or set the digital logic level of the pin:
- With no argument, return 0 or 1 depending on the logic level of the pin.
- With
value
given, set the logic level of the pin.value
can be anything that converts to a boolean. If it converts toTrue
, the pin is set high, otherwise it is set low.
-
pin.
pull
()¶ Returns the currently configured pull of the pin. The integer returned will match one of the allowed constants for the pull argument to the init function.