This example uses the Adafruit’s digitalio package to create a DigitalInOut object.

The LED should blink with on and off times of a half second.

import time
import board
import digitalio

led = digitalio.DigitalInOut(board.IO0)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)

This guide was first published on Dec 18, 2019. It was last updated on Dec 18, 2019.

This page (GPIO) was last updated on Dec 10, 2019.

Text editor powered by tinymce.