I have a Plasma2040 with an IOexpander connected (which I love, by the way).
I would like the Plasma2040 to send keypresses via USB to my laptop. Is it possible to do this using micropython?
If so, how do i install the relevant libraries alongside those necessary to work the LED strip?
Demonstration: in this video, the LED strips are controlled by the plasma 2040 and the projected video in the background is controlled by a laptop. I would like the same buttons that control the LEDs to send USB keypresses to the laptop to trigger certain animations.
Currently there are no official micropython libraries for USB HID (what you want for sending keypresses) but Hel mentioned it is being worked in their response here
Thanks for your reply.
I can see there are unofficial ways of doing this, but I’m starting to think it would be better to rewrite my code in circuitpython.
Just make sure that your current functions don’t rely on threading or interrupts, since circuit python barely supports the former, and not at all the latter right now. Those are currently the biggest pitfalls for switching to CiPy I’m aware of.
Hey, at least they have basic HID😅 I don’t have any threading or interrupts. It’s really a very, very simple script.
as long as you don’t try to send key sequences for unicode >.>
(banged my head on that recently, workaround is to call press/release for every keystroke)
Thanks for you advice 🙏 I have made a macropad before and it’s simple enough, but I didn’t realise I’d done it in circuitpy. So this is really just putting two projects together!
I am still working on this. Is there a circuit py library for the io expander (to connect it to some buttons and get keypresses that return true or false)? I have circuit python working fine on the plasma 2040, but I have no idea where to begin with the IO expander.
Looks like you have to compile it yourself for micropython from the c++ sources here
I have never done that before (compiled c++ into python). I will look into later, but any help you can give me would be appreciated. Is it very complicated? I can’t even imagine how the process will be.
Thanks in advance for your help.
Might be easier to use an Adafruit expander that already has CircuitPython support? The Largest UK Based Adafruit Distributor - Next Day Delivery - Pimoroni
This is the sort of reply I need! Thank so much. What a timesaver. I found a pi pico that I didn’t know I had so I’m just trying to see if I can get that working, but a £6 gadget is preferable to learning c++ 🤣
Pretty pleased with this video. I’m using a plasma 2040 (with a pimoroni-brand IO expander) to control the lights and an adafruit neotrellis to control the animations behind me.