Skip to content

pybricks-and-agentmode/activity2-chatmodes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Activity 2

This repository was created from the Pybricks template

The intention of this activity is to learn about using different chatmodes in GitHub Copilot Chat to implement a new feature in an existing codebase. You can change the prompts as you see fit, but the goal is to use RefinePrompt, Plan, and Agent chatmodes in sequence to implement the new feature.

Make sure to check the robot name in the launch.json file and update it to match your hub.

Steps

  1. Follow Python installation steps here 👇

  2. Test the Robot Blink script as-is to see the existing robot blinking animation. here 👇

  3. Change the chatmode to RefinePrompt

Prompt

Replace the robot blinking animation in robot_blink.py with a LEGO letter display where each letter (L-E-G-O) is built pixel-by-pixel with individual tiles dropping from top to bottom like Tetris pieces falling and stacking. Each dropped tile should stay lit and accumulate to form the complete letter before moving to the next letter.

  1. Switch to Plan chatmode and plan out the changes needed to implement the new LEGO letter display animation.

Prompt

Plan out the changes

  1. Switch to Agent Mode Prompt

Implement the changes planned, make sure to test by uploading to the hub

Quickly get started with Pybricks

Create a new virtual environment, install the dependencies from requirements.txt, and open thefolder in VS Code.

python3 -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`
pip install -r requirements.txt

Robot Blink Script

This repository includes a simple MicroPython script for Pybricks hubs:

robot_blink.py - Robot Face Animation

A script that prints "Hello World" and displays a blinking robot face using Matrix patterns on the LED display. The robot has sensors, eyes, and features that create a friendly animated face with periodic blinking.

.vscode/launch.json - VS Code Debug Configuration

A sample configuration for debugging Pybricks scripts directly from VS Code using the pybricksdev tool.

How to Run

  • F5 to start debugging in VS Code (ensure that you updated the launch.json with your hub name)
  • In terminal: pybricksdev run ble robot_blink.py -n "John"
  • Or run via USB connection: pybricksdev run usb robot_blink.py

Expected Behavior

  • Console prints "Hello World!" and animation status messages
  • LED matrix displays a robot face with sensors, eyes, and features
  • Eyes blink periodically (closed eyes are dimmer)
  • Pattern loops continuously with "Blink!" messages until stopped

Compatible Hubs

  • LEGO SPIKE Prime Hub
  • Not tested on other hubs but should work with minor adjustments

Note

  • Make sure your hub is powered on and connected before running the scripts.
  • Check the Pybricks documentation for more information on supported features and limitations.
  • When using Bluetooth, the Spike Prime Hub should be blinking blue to indicate it is in pairing mode.

The import errors shown in VS Code are normal - these scripts are designed to run on the MicroPython environment on the Pybricks hub, not in your local Python environment.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages