BriCode
Code environment for Brian - the brain brick
Features
- Wi-Fi Upload & Run: Upload Python files directly to Brian over Wi-Fi and execute them remotely, with console output streamed live.
- Integrated Debugging (F5): Press F5 on a Python file to upload and run it on Brian - no
launch.json required.
- Multiple Upload Methods: Wi-Fi upload with run, Wi-Fi upload only, or USB/local folder copy.
- Device Discovery: Automatically scan your network to find available Brian devices.
- Console Streaming: View real-time program output and send interactive input from VS Code.
- Copy Current File to Brian: Instantly copy the file you are working on to your selected Brian folder with one click.
- Status Bar Button: Quick access to upload and run the current file from the VS Code status bar.
- Right-Click Upload: Upload a
.py, .wav, or .jpg/.jpeg file straight from the Explorer or an editor tab.
- Install Brian Typing (autocompletion): Installs Brian's typing stubs globally via
python.analysis.extraPaths for IntelliSense in any Python project. The Control Panel shows install/update status.
Usage
Wi-Fi Upload & Run (Recommended)
Set up Brian's IP address:
- Use
BriCode: Discover Brian Devices to automatically find Brian on your network
- You can also use the
Connect to Brian (Wi-Fi) button in the Control Panel
Upload and run your code:
- Open a Python file (
.py)
- Press F5, or use the status bar's Upload and Run on Brian button
- No
launch.json is needed - BriCode uploads the active file to Brian over Wi-Fi and runs it, streaming output to the Debug Console
Other ways to send a file, if you don't want a debug session:
BriCode: Upload Current File - uploads without running
BriCode: Upload and Run Current File - uploads and runs in the background, without opening the Debug Console
- Right-click a
.py/.wav/.jpg/.jpeg file in the Explorer or an editor tab → Upload to Brian
View output:
- Debug Console output streams automatically when you start with F5 or
bricode.uploadAndRunDebug
- Otherwise, check the BriCode output channel and use
BriCode: Send Console Input to send input to a running program
USB/Local Folder Copy
- Open a file in VS Code.
- Use the Control Panel's Copy to SD Card section (or
BriCode: Copy Current File to Brian) to copy it.
- Select a Brian folder if prompted.
- Change the folder anytime via the Control Panel or
BriCode: Select Brian Folder.
Commands
Wi-Fi Commands
BriCode: Discover Brian Devices (bricode.discoverBrianDevices) - Scan network for Brian devices
BriCode: Set Brian IP Address (bricode.setBrianIp) - Manually configure Brian's IP address
BriCode: Upload Current File (bricode.uploadFile) - Upload file to Brian via Wi-Fi, without running it
BriCode: Upload and Run Current File (bricode.uploadAndRunFile) - Upload and execute file via Wi-Fi in the background
BriCode: Upload and Run Current File (Debug) (bricode.uploadAndRunDebug) - Upload and run via a debug session, streaming output to the Debug Console (same as pressing F5)
BriCode: Upload to Brian (bricode.uploadFileFromExplorer) - Upload a file selected in the Explorer or an editor tab
BriCode: Send Console Input (bricode.sendConsoleInput) - Send input to a running program
Local/USB Commands
BriCode: Copy Current File to Brian (bricode.copyCurrentFileToBrian) - Copy file to local Brian folder
BriCode: Select Brian Folder (bricode.selectBrianFolder) - Choose target folder for copying
BriCode: Install Brian typing (autocompletion) (bricode.downloadBrianTyping) - Install typing stubs for IntelliSense
BriCode: Toggle Debug Mode (bricode.toggleDebugMode) - Enable verbose logging
Configuration
Debug Configuration
Pressing F5 on a Python file works out of the box - BriCode registers a bricode debugger type and generates a default configuration (BriCode: Upload and Run (Wi-Fi), running ${file}) on the fly, so no launch.json is required.
If you'd rather pin a debug configuration to a specific file (instead of whatever's currently active), add one to launch.json via Add Configuration → BriCode, which inserts:
{
"type": "bricode",
"request": "launch",
"name": "BriCode: Upload and run current file",
"program": "${file}"
}
Change program to an absolute path if you want it to always run a particular file. Older launch.json entries with transport or runAfterUpload fields (from earlier BriCode versions) are no longer supported - USB transport and upload-without-run were moved to separate commands (see above); remove those fields if you see an error when starting the debug session.
Typing / Autocompletion
Typing installs into global storage and registers itself on python.analysis.extraPaths, so it's available in every Python project rather than just the one it was installed from. The Control Panel shows an Installed/Update badge (matching against the device's actual typing version is planned - it currently checks firmware version as a stand-in).
Troubleshooting
Wi-Fi Upload Issues
- Ensure Brian is connected to the same network as your computer
- Verify Brian's IP address with
BriCode: Discover Brian Devices
- Try toggling debug mode (
BriCode: Toggle Debug Mode) for verbose logging
Console Not Streaming
- Ensure you started with F5 or
BriCode: Upload and Run Current File (Debug) (not just "Upload" or the background "Upload and Run")
- Check the BriCode output channel (View → Output → Select "BriCode")
- Verify the program is actually running on Brian