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 being 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.

However! iOS beta 1 deleted files off some devices that are USB-Drive-like, for example, all the CircuitPython boards. The iPad also resets itself. And now on the GOOD NEWS, since the latest betas (and after filing a bug report) IT IS ALL WORKING! This means any code editor for iOS can be a great 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 is a step by step, the short version is: plug in Circuit Playground, copy file, paste file, open code, edit code, copy file, paste file, 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, so it will be even easier soon. For now, just use the iOS files app to move the files around.

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 CIRCPY, 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 and paste the code.py file.

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.

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 CIRCPY 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 CIRCPY 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.

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 🙂



from Adafruit Industries – Makers, hackers, artists, designers and engineers! https://ift.tt/313eG5j
via IFTTT