digitalio — Basic digital pin support

The digitalio module contains classes to provide access to basic digital IO.


All classes change hardware state and should be deinitialized when they are no longer needed if the program continues after use. To do so, either call deinit() or use a context manager. See Lifetime and ContextManagers for more info.

For example:

import digitalio
from board import *

pin = digitalio.DigitalInOut(D13)

This example will initialize the the device, read value and then deinit() the hardware.

Here is blinky:

import digitalio
from board import *
import time

led = digitalio.DigitalInOut(D13)
led.direction = digitalio.Direction.OUTPUT
while True:
    led.value = True
    led.value = False