Your Circuit Playground Express has a little red LED next to the USB port. It's labeled D13.

In EduBlocks, we are going to turn it on for half a second, then off for half a second, then back on etc. forever!

The Blinky LED Program

  • First, go ahead and add the CPX Easy block extension if you haven't already. Directions on how to do that are back on the "Block Types" page in the "Navigating EduBlocks" section of this guide.
  • From the Basic block category, drag in import time.
  • FromCPX Easy, import the necessary library by dragging it over.
  • Next in Basic, drag over a while True: loop. This is the main loop of the program and will run forever until the CPX is disconnected from power or reset.
  • Now in CPX Easy, drag in a cpx.red_led block. Set the value in the white bubble to True.
  • Now drag in a time.sleep() block and set the value to 0.5 which will be half a second.
  • Now drag in another cpx.red_led block and set its value to False.
  • Lastly, copy and paste the time.sleep() block from earlier by clicking on it, copying and pasting and dragging under the last block.

Downloading the Program and Uploading to the CPX

Once the blocks look good, click Download in the EduBlocks toolbar.

You may have to tell your browser you want to keep the file if asked. 

A file named should show up in downloads.

With the CPX plugged into the computer, drag to the CIRCUITPY drive.

The drive should now have the file on it and the code should be running!

Is the LED blinking on and off on your CPX?

Issues? Troubleshooting help here.

Here are the code files if you want to upload directly to EduBlocks or the CPX.

EduBlocks file:

CircuitPython Code:

import time
from import cpx
while True:
  cpx.red_led = True
  cpx.red_led = False

This guide was first published on Feb 05, 2019. It was last updated on Feb 05, 2019.

This page (Lesson 1: Blinky LED) was last updated on Feb 01, 2019.

Text editor powered by tinymce.