Choose Your Build Method
HayBox supports three main build methods:Local Build
Full control, fastest iteration. Requires installing dependencies.
GitHub Codespaces
Cloud-based VS Code. No local setup needed. Free tier available.
GitHub Actions
Automated builds on push. No local setup, but slower iteration.
Building Locally
Recommended for active development and customization.Prerequisites
Install dependencies
Build Process
Open project in VS Code
- Launch Visual Studio Code
- Click File → Open Folder
- Select the HayBox folder (containing
platformio.ini)
Configure long paths (Windows only - first time)
On Windows, if this is your first time building HayBox, run this command in any terminal:This prevents path length issues when building for Pico/RP2040.
Select build environment
Click the environment selector button in the bottom left of VS Code:
Choose your controller’s environment:RP2040/Pico Environments:
Choose your controller’s environment:RP2040/Pico Environments:pico- Generic Raspberry Pi Picob0xx_r4- B0XX R4c53- Crane’s Model C≤53schism- Schism controller
b0xx_r1/b0xx_r2- B0XX R1/R2arduino_leonardo- Arduino Leonardoarduino_micro- Arduino Microarduino_nano- Arduino Nanogccpcb1/gccpcb2- GCCPCBlbx- LBX

Wait for indexing to complete
Watch the bottom status bar for:
- “Rebuilding IntelliSense Index”
- “Loading Project Tasks”
First build for Pico: May take 5-10 minutes as PlatformIO downloads 2-3GB of dependencies. Subsequent builds are much faster.
Build the firmware
Click the Build button (checkmark icon) in the bottom left.The compiled firmware will be located at:
Upload firmware
For Pico/RP2040:
- Hold BOOTSEL button while plugging in (or RT2/C-Down if HayBox already installed)
- Drag
firmware.uf2onto theRPI-RP2drive that appears
- Plug in controller via USB
- Click Upload button (right arrow icon) in bottom left
Building with GitHub Codespaces
Build and edit HayBox in the cloud without installing anything locally.Create a fork
- Log in to GitHub
- Navigate to HayBox repository
- Click Fork in the top right
- Create the fork under your account
Create a Codespace
- In your fork, click the green Code button
- Select the Codespaces tab
- Click Create codespace on master
GitHub’s free tier includes 60 core-hours per month. Make sure to stop your Codespace when not using it.
Build firmware
Follow the same steps as building locally:
- Select your environment
- Edit config files if needed
- Click Build
Download compiled firmware
Since you can’t use the Upload button in Codespaces:
- Open the Explorer sidebar (folder icon)
- Navigate to
.pio/build/<environment>/ - Right-click
firmware.uf2(orfirmware.hex) - Select Download
- Flash manually using the installation guide
Stop Codespace when done
To preserve your free tier quota:
- Click your profile icon in bottom left
- Select Stop Current Codespace
Building with GitHub Actions
Automatically build firmware whenever you push changes.Fork and enable Actions
- Fork the HayBox repository
- In your fork, go to Settings → Actions → General
- Select Allow all actions and reusable workflows
- Click Save
Edit code in browser
Use GitHub’s built-in editor:
- Navigate to your fork
- Press
.(period key) to open github.dev editor - Edit your config files in
config/<environment>/config.cpp
Commit and push changes
- Click Source Control icon in left sidebar
- Stage your changes (click + next to files)
- Write a commit message
- Click Commit & Push
Monitor build progress
- Go to the Actions tab in your repository
- Click on your latest workflow run
- Watch the build progress for each environment
Download artifacts
Once the build completes:
- Scroll to the bottom of the workflow run page
- Download the artifact for your environment (e.g.,
HayBox-<commit>-pico.uf2) - Flash the firmware using the installation guide
Customize Build Matrix
Optimize build times by only building environments you need:PlatformIO Configuration
Environment Structure
Each build environment is configured inplatformio.ini and its corresponding config/<env>/env.ini:
Available Base Environments
| Base Environment | Platform | Use Case |
|---|---|---|
arduino_pico_base | RP2040 | Raspberry Pi Pico and RP2040 boards |
avr_usb | AVR | Arduino with native USB (Leonardo, Micro) |
avr_nousb | AVR | Arduino without USB (Uno, Nano, Mega) |
Customizing Button Mappings
Edit Config File
Each environment has its own config inconfig/<environment>/config.cpp:
Button Name Reference
| Button Code | Typical Function | Melee Mapping |
|---|---|---|
BTN_LF1 - BTN_LF5 | Left face buttons | Up, Down, Left, Right, L |
BTN_LT1, BTN_LT2 | Left triggers | Mod X, Mod Y |
BTN_MB1 - BTN_MB3 | Middle buttons | Start, Select, Home |
BTN_RT1 - BTN_RT5 | Right triggers | A, C-Down, C-Left, C-Up, C-Right |
BTN_RF1 - BTN_RF4 | Right face buttons | B, X, Z, R |
BTN_RF5 - BTN_RF8 | Extra buttons | Lightshield buttons |
Button codes are logical identifiers. The actual function depends on the game mode you select.
Advanced Customization
Creating Custom Input Modes
Create custom modes for different games:Configuring SOCD Cleaning
Set simultaneous opposite cardinal direction (SOCD) behavior:| SOCD Type | Behavior |
|---|---|
SOCD_NEUTRAL | Left + Right = Neutral (default) |
SOCD_2IP | Second Input Priority with reactivation |
SOCD_2IP_NO_REAC | Second Input Priority without reactivation |
SOCD_DIR1_PRIORITY | First direction always wins |
SOCD_DIR2_PRIORITY | Second direction always wins |
SOCD_NONE | No SOCD resolution (game decides) |
Troubleshooting Builds
Common Build Errors
Long path errors (Windows)
Long path errors (Windows)
Run this command and rebuild:
Missing dependencies
Missing dependencies
PlatformIO should auto-install dependencies. If it fails:
Upload failed
Upload failed
For Pico: Make sure it’s in bootsel mode (RPI-RP2 drive visible)For Arduino: Check that the correct COM port is selected in Device Manager
IntelliSense errors (red squiggles)
IntelliSense errors (red squiggles)
Wait for “Rebuilding IntelliSense Index” to complete. If persists:
First Build Taking Forever?
Pico builds: First build downloads 2-3GB of dependencies (SDK, toolchains, libraries). This is normal and only happens once. Subsequent builds are much faster (typically under 30 seconds).
Next Steps
Installation Guide
Learn how to flash your compiled firmware
Customization
Deep dive into SOCD modes, modifiers, and advanced features
Mode Selection
Configure button combinations for switching game modes
Input Sources
Add Nunchuk, GameCube controller, or switch matrix inputs
