So I’ve been having a little bit of a hack (at HackWimbledon) on the Adafruit Clue alpha and having some of Elecfreaks Joystick:bits to hand I thought I’d get them working together. The Joystick:bit has been replaced by a version 2.
Apart from anything else, all the supporting code and libraries (what little there were) have been updated for the new Joystick:bit. Which is a pain as the original has the oddest buttons you’ve ever seen. To pack all six buttons into the controller, the Elecfreaks design gets each button to apply a different resistence to connection. No button mashing for you! There’s no button trigger or edges, just a change in resistance and multiple buttons, who really knows.
Anyway, I still wanted to have a hack with this and dug out some code that appeared to be appropriate. It was, kinda, but the button decoder gave me nightmares when I realised it was doing 60 plus scans of a button list to figure out which button was down. It was epic slow. Never mind; I did a rewrite of that code and got it tolerably fast enough. I pushed on and embedded the new functions into a variant of Adafruit’s demo code for the Clue.
Things worth mentioning - The clue
simple_text_display class is super useful. It lets you display multiple lines of text without worrying about how you are formatting each line relative to other lines. Instant dashboard, just add strings. Oh and you can have a nice big title too.
So that’s the code. In the process of putting it together, I started using VSCode and the super CircuitPython extension. It’s a very fresh/raw extension but already it makes coding on the Clue and other CircuitPython devices so much more mainstream. The Mu Editor is great for beginners but when you spend your day in VSCode, you really want to stick with it in the evening.
But this all puts me back to square one… the idea was to use the Joystick:Bit as a controller for a Tetvasion (game) prototype but the stick is quite squidgy and analogue and the buttons are in no shape to be launching pixellated death, being almost analogue. So, I have to wait till I can get my hands on version two, which will be a long wait as the price of shipping on two joystick:bit 2’s is twice the cost of the joysticks and … lets not mention the shipping.
Still, the Clue and VSCode CircuitPython are fun. Both recommended.