Good Bye Trinket. Hello WebTigerPython?

Über ein Video von Rhett Allain erreichte mich die betrübliche Nachricht, daß die Online-Python-IDE Trinket im August dieses Jahres den Dienst einstellt. Zwar soll die Software, die Trinket antreibt, unter einer Open-Source-Lizenz veröffentlicht werden, die Trinket-Website wird aber definitiv geschlossen. https://kantel.github.io/posts/2026020501_trinket_ende/ #Python #Trinket #WebTigerPython #Turtle #VPython #CreativeCoding #Spyder #Physik

Noch mehr fraktale Bäume mit Python und der Schildkröte

Meine bisherigen, recht gelungenen Experimente mit CPythons Turtle und nahezu identischem Quellcode mit Trinkets Schildkröte haben mich zu weiteren Experimenten animiert. Dieses Mal habe ich wieder einen fraktalen Baum konstruiert und sowohl in Trinket wie auch in Standard-Python implementiert: https://kantel.github.io/posts/2025082201_fractal_trees/ #Python #Turtle #Trinket #Fraktale #CreativeCoding

In a city trembling with protests, the sound of music fades… but a small blue owl trinket keeps watching. Here is the link: https://open.substack.com/pub/denizece/p/the-blue-owl?r=5fi2hc&utm_campaign=post&utm_medium=web&showWelcomeOnShare=true
#ShortStory #Fiction #Literature #Storytelling #CityLife #Trinket

Arbor Pythagorae mit CPythons Schildkröte und mit Trinkets Turtle

Nachdem mein letztes Experiment mit CPythons Turtle und dem nahezu identischen Quellcode in Trinket so erfolgreich verlaufen war, hatte ich Blut geleckt nund wollte eines meiner Lieblingsobjekte, den Pythagoras-Baum, auch mit Pythons Turtle (und parallel dazu auch mit Trinkets Schildkröte) realisieren. https://kantel.github.io/posts/2025080201_arbor_pythagorae/ #Python #Turtle #Trinket #CreativeCoding

Ein fraktaler Baum mit Pythons Turtle

In diesem Beitrag möchte ich wieder Pythons Turtle bemühen, um damit fraktale, selbstähnliche Bäume zu erzeugen. Und auch wenn ich große Sympathien für die Turtle-Implementierung in TigerJython habe, ihr Nachteil ist, daß sie große Unterschiede zu der Turtle-Implementierung in Standard-Python besitzt. Daher habe ich mich bei diesem Beispiel entschieden, Trinkets-Turtle wieder hervorzukramen. https://kantel.github.io/posts/2025073001_fraktaler_baum/ #Python #Turtle #Trinket #Fraktale

New product added to my store is a scallop shell trinket dish with small flowers etc set into resin

#trinket #trinketdish #handcrafted #handmade #scallopshell #nature #resin #smallbusines

https://sarahsboutique.co.uk/shop-now/ols/products/resin-shell-trinket-dish

Auf zu neuen Ufern? Python im Browser

Bei all meiner (wiedererwachten) Begeisterung für TigerJython habe ich nicht vergessen, daß der Software eine wichtige Eigenschaft fehlt: TigerJython läuft nicht im Browser. Das ist natürlich in der heutigen Zeit ein schwerwiegendes Handicap und so habe ich mich nach Alternativen umgeschaut. https://kantel.github.io/posts/2025062801_python_im_browser/ #Python #TigerJython #Trinket #Turtle #VPython #PyScript #Proseco #PygameCE #Pygbag #Pyxel #microStudio #Brython #CreativeCoding

CircuitPython USB to Serial MIDI Router

I’ve indirectly used USB and Serial MIDI with CircuitPython a few times now, but haven’t explicitly shown how to use it as a simple USB (device) to serial MIDI converter.  This project shows how to do that.  Any CircuitPython device should be usable like this, but I’ve used this as an excuse to do something with the Seeedstudio Seeeduino XIAO board.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key tutorials for the main concepts used in this project:

If you are new to microcontrollers, see the Getting Started pages.

Parts list

The Circuit

If you are using a Raspberry Pi then the circuit is one I’ve used several times already.  Connect up your 3V3 compatible MIDI module to GND, 3V3, RX and TX.

If you are using a Trinket M0 then there is a really good learning guide on the Adafruit site that will get you going – again you’ll need the same GND, 3V3, RX and TX pins.

In my case, I wanted an excuse to do something with a Seeedstudio Seeeduino XIAO module.  This is a SAMD21G based module with a USB-C connector, and would need to be connected up as follows.

The general idea is that the CircuitPython device will connect to a PC (or other USB host) as a USB MIDI device and forward any MIDI traffic between the USB MIDI link and a connected serial MIDI module.

The Code

The basic idea is relatively straightforward once your device is up and running with Circuitpython itself (see the Adafruit guides for help to get this far!):

Set up the USB MIDI deviceSet up the serial MIDI devicewhile: IF there is a USB MIDI IN message THEN Send it out on the serial MIDI OUT port IF there is a serial MIDI IN message THEN Send it out on the USB MIDI OUT port

The only slight quirk is that I try to filter out unrecognised MIDI messages to limit the forwarded traffic, but if you haven’t imported the adafruit_midi representation of a MIDI message, then the code will not recognise it!  So I need to pull in the various MIDI message representations at the start of the file.

Not being a python person myself really, I may well be missing something and there might be a more elegant way to do this, but I have to say I’m not really a fan of how MIDI is implemented in CircuitPython as it feels too hidden away behind “clever layers” for my liking.  But having said that, there really is no easier way (at present) for making a USB MIDI device than CircuitPython.

The code also supports flashing an LED on reception of a MIDI event.  For the XIAO this looks like the following:

led = digitalio.DigitalInOut(board.D13)led.direction = digitalio.Direction.OUTPUTled.value = Truedef ledOn(): led.value = Falsedef ledOff(): led.value = True

With the XIAO the LED is on when led.value = False.  For the Raspberry Pi Pico, it would be different again, something like the following (untested, but pasted in from my other code):

led = digitalio.DigitalInOut(board.GP25)led.direction = digitalio.Direction.OUTPUTdef ledOn(): led.value = Truedef ledOff(): led.value = False

Some boards support the Python/CircuitPython “built in LED” identifier – you might be able to get away with using board.LED above, but the True/False logic still needs setting up correctly for your board.  Some boards are now using board.LED_INVERTED too, so just see what works.

One way to see what is supported is to do the following in the REPL shell when connected to the board:

>>> import board
>>> dir (board)

Also, whilst the XIAO and other boards have board.TX and board.RX defined for the default serial port, the Raspberry Pi Pico does not, so the code to initialise the serial MIDI will also have to be changed to look more like the following for the Pico (this is to use UART 0 on GP0 and GP1).

uart = busio.UART(tx=board.GP0, rx=board.GP1, baudrate=31250, timeout=0.001)

The original was:

uart = busio.UART(tx=board.TX, rx=board.RX, baudrate=31250, timeout=0.001)

Find the XIAO version on GitHub here.

Closing Thoughts

As always, I continue my love/hate relationship with CircuitPython (and Python more generally), but I can’t deny, this is still probably the easiest way to get a USB MIDI device to serial MIDI converter up and running!

Now USB MIDI Host… well that is another story…

Kevin

#circuitpython #midi #raspberryPiPico #trinket #usbMidi #xiao