To demonstrate how to download and transfer code to the CPB via the File Glider and Files apps, I will use the code from the NeoPixel Rainbow Touch PyLeap project. This code allows you to change the colors of the NeoPixels on the CPB by touching the various input-output (IO) pads.

Step 1: Unplug your CPB from your computer and power it from a battery or a wall outlet.

The files will not be able to transfer to the CPB while it is connected to your computer. You must power it separately from a battery or 5V power source from the wall. If the CPB is connected over USB then that prevents writing files over BLE. Otherwise, you risk corrupting the file system.

The code cannot be transferred from the Files app to the Glider app if the CPB is connected to a computer. It must be powered separately from a computer.

Step 2: Download the Code to the Files app on your iOS device

Open this guide on your iOS device in Chrome, Safari or your browser of choice. Click the "download project bundle" from the code below. When prompted, click "download".

# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT

"""
Circuit Playground Bluefruit Capacitive Touch Rainbow

Touch the each of the touchpads around the outside of the board to light up the pixels a different
color for each pad touched.
"""
from adafruit_circuitplayground import cp

cp.pixels.brightness = 0.3

while True:
    if cp.touch_A1:
        cp.pixels.fill((255, 0, 0))
    if cp.touch_A2:
        cp.pixels.fill((210, 45, 0))
    if cp.touch_A3:
        cp.pixels.fill((155, 100, 0))
    if cp.touch_A4:
        cp.pixels.fill((0, 255, 0))
    if cp.touch_A5:
        cp.pixels.fill((0, 135, 125))
    if cp.touch_A6:
        cp.pixels.fill((0, 0, 255))
    if cp.touch_TX:
        cp.pixels.fill((100, 0, 155))
  • Now click "open in..." and you will be prompted with some options on where to save the files.
  • Choose "Save to Files" from the list provided. Select the folder "On My iPhone/iPad".
  • I made a folder in the "on My iPhone" folder called "Adafruit" and saved it there.
  • If you would like to make a new folder, you can click the folder + icon on the top right of the screen.

 

Step 3: Transfer Files from Files App to File Glider

Head to your Files app on your iOS device. To find the Files app, search your iOS device for "Files" and you should see an app with an icon of a blue folder pop up.

  • Select the folder "On My iPhone/iPad". Then navigate to where you saved the code files.
  • Next, click the .zip file and a folder called PyLeap_Bluefruit_Touch_NeoPixel_Rainbow should appear.
  • Click on the folder and then select the folder entitled CircuitPython7.x.
  • You will now see a code.py file and a lib folder. These are the files you will transfer to the CPB via the File Glider App.

First, press and hold onto the code.py file for a couple of seconds and you will see a list of options appear. 

  • Select the "move" option and choose the CIRCUITPYxxxx folder within File Glider as the destination.
  • Then click "copy".
  • Do the same with the lib folder.

Congrats you have just successfully programmed the CPB!

This guide was first published on Feb 09, 2022. It was last updated on Feb 09, 2022.

This page (Code the CPB) was last updated on Mar 05, 2023.

Text editor powered by tinymce.