The browser-based Arcade game player supports a number of inputs like keyboard, mouse or gamepads. If you can emulate a keyboard, you can build a controller!
The idea to build custom controller by emulating a keyboard was pionered by Makey Makey. In this guide, we will show how to use MakeCode to turn your beloved Adafruit boards, like Circuit Playground Express, into a keyboard and ultimately an awesome custom Arcade controller.
Inputs to your game can be:
- Buttons on the Circuit Playground Express
- Capacitive touch (metal, fruit, etc.)
- Any sort of switch, like arcade style buttons, big mashable buttons, etc.
- Sensor readings on the Circuit Playground Express like light, sound, movement, etc.
MakeCode Arcade supports 2 players on a keyboard using typical game key assignments.
Microsoft built a MakeCode extension that exposes custom blocks and functions to turn any hardware into a custom controller. It takes care of emitting the keystrokes with the correct order and timing so that it really looks like a real keyboard.
The extension is hosted on GitHub at https://github.com/microsoft/pxt-maker-controller and we'll be showing how to use it the next pages.
Get your microcontroller and plug it into your computer via a known good data + power USB cable.
Circuit Playground Express
To use the maker-controller extension with the Circuit Playground Express,
- In your web browser, open https://makecode.adafruit.com/beta
- Click on New Project
- Click on Extensions under the gearwheel menu (upper right on the screen)
- Type or copy https://github.com/microsoft/pxt-maker-controller into the search box.
Maker (Feather Express, Metro Express, and other MakeCode Maker compatible boards)
To use the maker-controller extension with the MakeCode Maker,
Remember that when you'll plug your custom controller into your computer, it will start generating keystrokes regardless where the focus is. So make sure to leave any text editor before using it...
You can unplug your board from USB to stop it from sending characters if need be.