Coding on SPOKE

SPOKE uses the Circuitpython coding language to work. It is an amazing open source version of Python that makes coding super easy. You won’t need to learn everything in the code in order to edit your devices, just changing a few numbers or letters here and there are enough to completely change what SPOKE does.

The code lives on the board in a file called “code.py”. It should always be saved as code.py as that is the file the board automatically runs on powering up.

There are a few different ways of editing the code. The simplest is just opening it in Notepad or any basic text editor. There is also a web-based circuitpython editor on the circuitpython website here: https://code.circuitpython.org/. It is also editable in IDE’s such as Thonny. These last two have the benefit of having a way to see any errors that might turn up if something doesn’t work quite right!

Opening the code should look a bit like this:

The first few lines explain a bit about what the code is going to be doing. We’ve added explanations in each example. Anything after a “#” is ignored by the code, so we can type whatever we want there.

The next part is setting up the board to be able to do different things, this is where we import things called libraries. These are essentially shortcuts that let us not have to write out huge chinks of code everytime we want it to do something.

After this we have the setup for what MIDI notes our touch pins are going to play. Editing these numbers will edit what midi note gets played. It’s that simple!

SPOKE can do way more than just send single MIDI notes. It can send chords, arpeggiate, send sequences of notes, act as a step sequencer and probably more we’ve not tried yet! There is a github page here with example code, all you need to do is copy and paste the code into the board and hit save! https://github.com/Tom-Vulpes/Spoke/tree/main/MIDI%20

SPOKE can also work as a Human Interface Device, a HID, and act as a keyboard or a mouse. There are example code for that on the Github page too.