Overview
Now you can code without cables! In this guide, you’ll be able to use any iOS device, such as an iPhone or an iPad, to easily transfer files to a Circuit Playground Bluefruit (CPB). This is made possible by the new File Glider Application for iOS. This app allows you to connect to a CPB from your iOS device then you can transfer files to the CPB through the Files app. Once connected, you’ll also be able to create, move, rename and delete files and directories through the Files app. Additionally, the File Glider app enables you to write and edit code directly to the CPB!
This will be demonstrated using an example Rainbow Touch program where the colors of the NeoPixel LEDs on the CPB can be changed with the touch of any I/O pin.
To power the CPB SEPARATELY from your computer (more on this later), you have a choice of:
OR
Alternatively, you can use the USB cable from your computer and plug it into this adapter to power the CPB without plugging into a computer:
Page last edited March 08, 2024
CircuitPython
CircuitPython is a programming language designed to simplify experimenting and learning to program on low-cost microcontroller boards.
Currently, the File Glider App requires a Circuit Playground Bluefruit board running the most recent build of CircuitPython 7. If you haven't already, you'll need to download the latest version of CircuitPython from the link below. For more on CircuitPython, check out this guide.
Plug your Circuit Playground Bluefruit into your computer using a known-good data-capable USB cable.
A lot of people end up using charge-only USB cables and it is very frustrating! So make sure you have a USB cable you know is good for data sync.
Double-click the small Reset button in the middle of the CPB (indicated by the red arrow in the image). The ten NeoPixel LEDs will all turn red, and then will all turn green. If they turn all red and stay red, check the USB cable, try another USB port, etc. The little red LED next to the USB connector will pulse red - this is ok!
If double-clicking doesn't work the first time, try again. Sometimes it can take a few tries to get the rhythm right!
(If double-clicking doesn't do it, try a single-click!)
Page last edited March 08, 2024
File Glider App Set Up
From the description in the App store, File Glider allows you to:
Wirelessly transfer files to and from file transfer-ready Bluetooth Low Energy (BLE) firmware. You can browse and edit files from within File Glider or use the Files app integration to access the files from other apps. Multiple devices can be managed at once and access can be shared amongst multiple apps.
Basically, this app allows you to transfer files from your iOS device to your CPB wirelessly with a couple of taps. It also lets you add and edit code on the CPB directly from the App, how neat!
Step 1: Download the File Glider App from the App Store.
Using your iOS device, download the File Glider App.
Step 2: Connect your BLE board to your iOS device through the app.
Open the File Glider App after it finishes downloading and make sure your board is connected to your computer.
- Click the reset button on the board.
- You will see the board NeoPixels flash through a series of colors, first red, then yellow then blue.
- When the blue appears, click the reset button again.
- The NeoPixels will then flash through another series of colors then turn blue momentarily before turning off again.
- The app should then state "Status: connected..."
- Then a Bluetooth Pairing Request will pop up, select "Pair".
- The board is now connected to the File Glider App!
Troubleshooting
Problem: You try to connect your board but then you see the following error on the app "Disconnected: Peer removed pairing information"
Page last edited March 08, 2024
Code the CPB
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.
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!
Page last edited March 08, 2024
Play!
The Rainbow Touch sketch should be running on your CPB now, so test it out! You can tap various pads on the CPB with your finger and this will change the color of the NeoPixels.
Going Further with File Glider: Code on your Phone!
If you so wish, you can now edit and adapt the code on your CPB through the File Glider app directly from your iOS device.
- Open the File Glider App and make sure you are connected to your CPB. You should see CIRCUITPYxxxx listed under "Connected Peripherals:"
- At the bottom of the app, tap "Explorer". Now you will see all the files and code on your CPB.
- Tap on the code.py file. Now tap anywhere in the code and a keyboard should pop up.
- Add or edit any code and hit "save" above the keyboard.
- The code will be updated on your CPB!
Have fun coding away on your iOS device without any cluncky cables :)
Page last edited March 08, 2024