It’s now possible to open, edit, and save Python code on iOS for embedded electronics plugged in, CircuitPython USB devices! @apple #ios @circuitpython

Ipadyay-1

OK! Big news- It’s now possible to edit and save Python code on iOS to embedded electronics, CircuitPython USB devices!

This is a follow up to our post about Apple’s iOS 13 beta, which is now up to beta 5.

The upcoming iOS 13 allows iPads (and iPhones) to be more like computers, which means you’ll be able to do computer-like things such as plugging in a USB drive, opening up the Files app in iOS 13 and browsing the files. This is going to be fantastic for folks who want to use an iPad as their full-time desktop replacement, and if you’re a coder it looks like you’ll be able to do things like opening up Python .py files, use IDEs for coding, etc. A lot of schools use iPads, so this means any iPad will be able to be used to code for electronics: if the app can open a text file, it can be used to write Python.

iOS 13 beta 1 had some troubles: it deleted files off some devices that act like USB drives, for example, all the CircuitPython boards. But now the GOOD NEWS: we filed a bug report, and since iOS beta 5 IT IS ALL WORKING! This means any code editor for iOS can be used as a code editor for CircuitPython and you’ll be able to open, edit, and save your code to the device(s) plugged in to the iOS device!

Here’s a quick summary of how to edit a CircuitPython file now on an iPad running iOS 13 beta 5: plug in a CircuitPython board, such as a Circuit Playground Express, select a file on CIRCUITPY, drag or copy/paste the file to “On My iPad”, use an editor to change the file, then delete the original file on CIRCUITPY, copy/paste, share, or drag the file back to CIRCUITPY, giving it a new name, rename and it all saves and runs automatically. It’s awesome. The code editing apps are not aware of this new “USB storage” in iOS 13 yet; when they are (soon), it will be even easier. For now, just use the iOS Files app to move the files around.

Also, iOS 13 beta 5 clearly still has some bugs: you can’t save the file with its original name, so you need to to save with a new name, delete the old file, and rename the new file.

Version-1

We are currently using iOS 13 beta 5, released on July 29, 2019.

After loading the latest iOS 13 beta, we plugged in the Circuit Playground Express via USB to the iPad using the “Lightning to USB Camera Adapter.” For my demo, I have a code.py file on the device that runs the rainbow pattern. Once plugged in to the iPad, the Circuit Playground Express powers up and runs the program that is on the device (code.py).

Files

On the iPad tap the FILES app icon.

Listoflocations

Then, tap Locations > Browse and tap CIRCUITPY, that is the “USB Drive” that has the python code.

Press Hold

These are all the files on my Circuit Playground Express as viewed via the iPad.

Press and hold the code.py (displayed as code since it does not show the file extension at this time and/or I do not know the setting to change that). Tap COPY.

Copy On Local

Browse to the local file system (“On My iPad”) and paste the code.py file. Alternatively, you can drag code.py to “On My iPad”, though the dragging doesn’t seem to work all the time.

Koder

Now pick an app that can edit code. For the app to test out opening, editing, and saving the Python code that is on the Circuit Playground Express, we are using Koder. What is Koder?

Koder is a code editor for iPad and iPhone. It does have many features including syntax highlighting, snippet manager, tabbed editing, find and replace code, editor theme, remote and local files connections, and many more.

With Koder you can code anytime and anywhere, no matter if you’re at your desk or while on the go.

There are other apps for code editing on iOS (post your suggestions in the comments), this is one that I happen to use. We have also tried Textastic, and it also works.

01Open

01Open02

Open up code.py, in Koder I tapped Files, and then tapped the pad of paper with pencil icon.

02Open

03Open

Click “Open Other Apps’ File” and open code.py

04 Code Editing

Edit the code!

Listwithpresshold

Next up, after editing, go back to the FILES app, copy the saved code.py on the local iPad storage, then browse to CIRCUITPY and paste the file. iOS at this time will name it code 2 and does not overwrite it, so rename the current code.py (I used _code) and then rename the one that was just pasted to the CIRCUITPY drive. With CircuitPython, saving the code, and/or saving a file to the USB “drive” automatically starts the device and will run the code, again – automatically.

If you’re trying this with Textastic, the work flow is a little different. You can share the file from “On My iPad” to Textastic. Then edit the file. Then touch the Share icon in Textastic (in the three dots menu in the upper right), choose “Save to Files”, and save the file with a new name. Then go back to CIRCUITPY in the Files app, delete the old file, and rename the new one to the old name.

iOS 13 beta 5 clearly still has some bugs: you can’t save the file with its original name, so you need to to save with a new name, delete the old file, and rename the new file.

That’s it, it “just works” and it is really a great experience to code on my iPad with CircuitPython running on Circuit Playground! I’ll make a little video later, going to code on the couch with my iPad and CPX now 🙂


Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards

Join Adafruit on Mastodon

Adafruit is on Mastodon, join in! adafruit.com/mastodon

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 9/13/2024 Featuring Adafruit Feather RP2350 with HSTX Port! (Video)

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: The latest on Raspberry Pi RP2350-E9, Bluetooth 6, 4,000 Stars and more! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

Adafruit IoT Monthly — IoT Vulnerability Disclosure, Decorative Dorm Lights, and more!

Maker Business – Adafruit Daily — A look at Boeing’s supply chain and manufacturing process

Electronics – Adafruit Daily — Autoscale is cheating!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



1 Comment

  1. This is really good news!!! I’ve been writing python on my iPad for years now (using Pythonista). I’ve built a number of small robots and I’m looking forward to being able to take my kit anywhere to work. Thanks for filing the bug and keeping on top.

    Now, we just need a IDE mechanism (app) to read the serial line while programming! : )

Sorry, the comment form is closed at this time.