Creating Code
Installing CircuitPython generates a
code.py file on your CIRCUITPY drive. To
begin your own program, open your editor,
and load the code.py file from the
CIRCUITPY drive.
If you are using Mu, click the Load button
in the button bar, navigate to the
CIRCUITPY drive, and choose code.py.
Copy and paste the following code into your editor:
import board
import digitalio
import time
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = True
time.sleep(0.5)
led.value = False
time.sleep(0.5)
If you're using a KB2040, QT Py or a Trinkey, please download the NeoPixel blink
example().
The KB2040, QT Py and the Trinkeys do not have a built-in little red LED! There is
an addressable RGB NeoPixel LED. The above example will NOT work on the
KB2040, QT Py or the Trinkeys!
The NeoPixel blink example uses the onboard NeoPixel, but the time code is the
same. You can use the linked NeoPixel Blink example to follow along with this
guide page.
©Adafruit Industries Page 44 of 263