Welcome to the official code repository for the Flame Bots FLL team! This repository contains all the Python code for our robot, designed to run on the LEGO SPIKE Prime Hub using Pybricks.
Follow these instructions to get a copy of the project up and running on your local machine and on the robot hub for development and testing purposes.
- A computer with an internet connection.
- A web browser (like Chrome, Firefox, or Edge) that supports Web Bluetooth/Serial.
- A LEGO SPIKE Prime Hub.
- A USB cable to connect the hub to your computer.
If you don't have a GitHub account, you'll need to create one to contribute to the project.
- Go to https://github.com/join.
- Follow the on-screen instructions to create your free personal account.
- Install GitHub Desktop application, which provides a graphical interface to interact with GitHub.
- (Optional for advanced users) Install Git on your computer and configure it with your GitHub username and email. This will allow you to use the command line for version control.
"Cloning" the repository means creating a local copy of the project on your computer.
- Navigate to the main page of this repository on GitHub.
- Click the green
<> Codebutton and select "Local" tab. - Click "Open with GitHub Desktop". If prompted, allow your browser to open GitHub Desktop.
- In GitHub Desktop, confirm the repository details and click "Clone". Make sure you select a local folder on your computer to store the cloned repository.
- This will create a new folder named
fllflamebotscontaining all the project files in your chosen local path.
Once you have the code on your computer, you can open the files in any text editor or IDE (like VS Code) to read and edit them.
Our project has a simple structure:
unearthed/mainrobot.py: This is the main entry point for our robot. It displays a menu on the hub's screen, allowing you to select which mission program to run.unearthed/sample_setup_run.py: This is an example of a mission program. It demonstrates how to initialize Pybricks code with proper hub wiring, driving wheels, motors, and sensor settings, and contains a few examples of movements and actions for the robot to work on.
The code is written in Pybricks's block coding interface, and downloaded as Python files.
To run the code on the robot, we use the Pybricks web interface.
- Connect the Hub: Turn on your LEGO Hub and connect it to your computer using Bluetooth.
- Open Pybricks Code: In a compatible web browser (like Google Chrome), go to https://code.pybricks.com/.
- Connect to Hub in Pybricks: Click the Bluetooth or USB icon in the Pybricks interface and follow the prompts to connect to your hub. Once connected, the hub will play a sound, and the icon will turn green.
- Import and Run:
- In the Pybricks editor, click the "File" menu, then "Import a file".
- Navigate to the
fllflamebots/unearthedfolder you cloned earlier. - Select the Python file you want to import (e.g.,
mainrobot.py). - After importing, you can run the file by clicking the "Run" button.
For more detailed instructions, please refer to the official Pybricks documentation.
To use keyboard shortcuts (like Ctrl+Shift+R to run code), you need to configure your VS Code user settings.
- Open VS Code settings (
.vscode/settings.json) and ensure"fllflamebots.active": trueis present (it should already be checked in). - Open your global Keyboard Shortcuts JSON:
- Press
Ctrl+Shift+P. - Type "Preferences: Open Keyboard Shortcuts (JSON)".
- Press
- Add the following entry to the list:
{
"key": "ctrl+shift+r",
"command": "workbench.action.tasks.runTask",
"args": "Run Pybricks on Robot",
"when": "config.fllflamebots.active"
}We encourage all team members to contribute!
- Create new files in Pybricks web interface for your missions.
- Once working, download your files to
fllflamebots/unearthedfolder. - Using Github Desktop app to add your files and commit. Each commit requires descriptions to help others understand what you have added/changed.
- Note that "commit" only happens on your own computer. The last step is to use Github Desktop to push your committed changes to Github server, thus all team members can see your latest changes.
Happy coding, and go Flame Bots! 🔥