COMPUTER CONTROL
It is very easy to setup your SPOKE to be something called a Human Interface Device. The best examples of these devices are USB keyboards and USB Mouses, mice, mices?
We are using the Circuitpython HID Library in our code to be able to turn our SPOKE into one of these devices. Check the post on CHANGING THINGS if you’re not sure how to edit the code yet. The Github page has a few examples of HID devices which are easily customisable: https://github.com/Tom-Vulpes/Spoke/
Keyboard
For example, the “Keyboard-HID-Letters” code turns your SPOKE into a keyboard with all 26 letters. This can be used for tons of projects where you want to control either a game, piece of software, visuals, VLC player etc using hotkeys.
If you wanted to have a space-bar input instead of a letter, you would just change ("Z", [Keycode.Z]) to (“Z”,[Keycode.SPACEBAR]).
You can also combine pins to have two button inputs, for example changing ("Z", [Keycode.Z]) to (“Z” [Keycode.LEFT_CONTROL, Keycode.C]) would now make that pin a shortcut to Copy.
The full list of keyboard commands are documented here: https://docs.circuitpython.org/projects/hid/en/latest/api.html
The most useful ones we have found are “RIGHT_ARROW” “LEFT_ARROW” “UP_ARROW” “DOWN_ARROW” “ENTER” and “WINDOWS”.
MOUSE
The MOUSE-HID code on the github page allows your SPOKE to control your mouse cursor using the first 5 pins. With GP0 and GP1 moving your cursor left or right, pins 2 and 3 moving your pins up or down, pin 4 being a left mouse click and pin 5 being a right mouse click. On line 17 of the code you can adjust the speed that the cursor moves.
GAMING
One other example we have provided gives all the default controls needed to play Minecraft on PC. https://github.com/Tom-Vulpes/Spoke/blob/main/MINECRAFT-HID%20Controls
It includes codes for controlling both keyboard and mouse at the same time. These controls can obviously be edited to suit other games by editing the code part that says [Keycode.Q] to [Keycode.WHATEVERLETTERYOUWANT]