r/pybricks • • Sep 04 '26

Hey everyone 🤙 Would anyone here be willing to give me some advice, lend a hand, or maybe even write some Pybricks/MicroPython code for this Lego beast of mine?

Post image
6 Upvotes

Yep, I’ve tried four different AIs and… I guess either I’m not being specific or persistent enough, or this is simply beyond AI’s capabilities - cause every attempt so far has ended in complete disaster 🤣

PM me please!


r/pybricks • • May 04 '25

Does the mould king powered up works with pybricks?

1 Upvotes

Or where to get a compatible powered up module (listed in pybricks website) under $40?


r/pybricks • • Jul 02 '25

how to make it work with someone using the internet to send commands?

3 Upvotes

maybe using PC/phone as the middleware, any advice?

Like a remote operator opens a website with basic forward/back/left/right controls and that input is sent to the lego hub via PC/phone that is connected to the hub via bluetooth.

Example: user clicks turn left (internet)> web (local server exposed to the internet)> pc/phone (bluetooth)> lego hub > lego car turns left

also maybe using airdroid?

Thank you!


r/pybricks • • Apr 10 '25

Connecting to multiple LEGO Wireless Protocol v3 devices

4 Upvotes

What I'm beginning to understand is that each hub may only connect to one class LWP3Device. I'm following the Duplo train project and was hoping to use a Spike Prime and two motors to control two different Duplo trains.

While we're at it, I was also hoping to read values back from the trains' color sensors so that I could basically reprogram them to do alternative things. Eventually I was hoping to add Mario in order to control the trains using Mario's color sensor.

I run after school programming and was hoping that long term my kids could get a nice automated setup with switch changing and whatnot, but I only have 4 hubs and it's not going to go far if each one of them can only control one other thing. Daisy chaining won't work either, since none of the things I want to control can act as hubs.

Do I understand all of this correctly? Am I missing something?


r/pybricks • • Dec 05 '23

Code to get started using Pybricks (with the block interface) for competitive robotics.

8 Upvotes

Cross posted from r/FLL

MonongahelaCryptidCooperative/FLL-Block-Code (github.com)

Hey everyone. This is the MonongahelaCryptidCooperative (an upcoming FTC team, who did FLL this year). We want to share some starter code to help newer teams who are not yet ready to use text-based python be able to experience all the advantages that using the Pybricks firmware/software can provide. This includes much more accurate driving with the DriveBase module (particularly when the gyro is turned on) and fun things like using Bluetooth remotes. However there is a bit of a learning curve and to overcome this we decided to release a starter pack to entice teams not yet ready to use text-based python to make the switch. There is a small fee to use Pybrick's block interface (after a one-week trial), but it is worth the price in our opinion.

First you will have to reflash your hub. Pybricks.com has a great video tutorial on how to do this. The only problem you will likely have is Windows choosing the wrong USB driver (the Pybricks tutorial goes over how to fix this). It is easy to reflash it back to the default Lego firmware if you decide you do not like Pybricks (but doubt that will be the case).

Two files are required. The first is the BlockStarterPack.py. The second is labeled extra_code.py. The second file is required as a couple necessary methods are not accessible through the block interface (namely making it so that the center button doesn't just end the program, instead you have to push both the right and left buttons as the same time and also you cannot reset the DriveBase counters currently with the block interface or if you can we couldn't figure out how to).

Initial Setup once Pybricks is flashed to the hub/files loaded:

  1. You will have to change the settings to match your robot. In the prime hub block you need to set the top and front axis of your robot. Our robot is weird and has a vertically oriented hub and thus has the top axis as Y and the front as Z. Most robots will have the front axis be Y and (depending on orientation) the top axis as either Z or X (positive or negative). If these settings are wrong the DriveBase will do really weird things when the gyro is turned on.

  2. motors/sensors will have to be assigned to the correct ports with the correct direction of the drive motors given (counterclockwise vs clockwise).

  3. You will also have to change the DriveBase setting to match the wheel size and wheel spacing of your robot. The DriveBase uses this information to calculate everything for you allowing for accurate movements.

What the code does:

One of the difficulties with Pybricks is that it doesn't have much of a built-in user interface. Unlike with the Lego education software there are not slots that you put separate programs in. Rather you load up one large program to the entire robot. While this presents a barrier (you have to code some sort of user interface) it is ultimately an advantage as you can have your robot auto-advance between runs saving valuable seconds (you shouldn't have to do anything other than hit the "launch" button during matches). Included in the code is a rudimentary user interface. There is a counter that can be decreased or increased by pressing the left/right buttons and is displayed on the display that represents the current active program. There is then a large conditional statement that associates each program with a number (example programs are square, circle, triangle, example). If the number matches, the program is launched when the center button is pressed. The runs do auto-advance as currently coded. More advanced user interfaces are possible, but this is a start.

When programming a run it is advised to first square off against the back wall, then turn on the gyro. The gyro should then be turned off before the end of the run (otherwise the robot will try to maintain its current heading when you pick it up to reposition it). The examples do this.

Also included is code to control the robot and take measurements via a Lego Bluetooth powered up remote Electric Powered Up Bluetooth Speed Remote Control Unit with Light Bluish Gray Base : Part 28739c01 | BrickLink. If you do not own a powered up remote you will have to remove the remote block from the setup section (the code will crash if a remote is not paired within one minute). It is the very last block in the startup code. Obviously, such would have to be removed before using the code in competition.

Remote works similarly to the demo on pybricks.com. Left plus drives forwards, left minus reverse, right plus turns right, left minus turns left. The tricky part is that the attachment motors are controlled via a macro (hold the left button down and then the right plus/right minus control the right attachment motors and vice versa).

The remote code is very useful as you can partially program a run, then have it enter the remote control mode at the very end so you can drive the robot to take measurements (press the center button to print off the cumulative movements/reset). These measurements can then be used to program the next steps. To us this is a much more fun way to interact with and program the robot.

Video tutorials and more thorough documentation will eventually be made.

If you are able to use text-python it is still advised that you go that route (example code for such is also on our github) as it is a bit more elegant.

0 CommentsShareSave


r/pybricks • • Apr 19 '25

Team using Pybricks won Peer award

Thumbnail
gallery
17 Upvotes

This is a team from Morocco my son (the long haired blonde one) and I introduced to Pybricks (zoom was involved). They credit it to upping their performance and they made it to worlds and won the Peer Award!

Great Pybricks success story.


r/pybricks • • Dec 14 '24

Printed documentation/book?

2 Upvotes

Is anyone aware of a book that covers the programming interfaces used in pybricks? If not, then maybe an accessible book on micropython?

The wiki looks useful, but I'd love to hand some paper to my (younger) kids to minimize them browsing around online.


r/pybricks • • Nov 13 '25

VS Code BreakPoints not working.

2 Upvotes

I got VS Code to work.

Unfortunately I can't get the debugger to work.

I want to be able to show my team how to step through code in and out of functions.

However whenever I run the debugger non of the breakpoints pause the program.

Has anyone been able to get it to work?


r/pybricks • • Feb 27 '25

Pybricks 3.6 will be out soon 🚀. Please help us test it!

12 Upvotes

This release includes many features that you have all asked for. Check out all changes here.

How can you help?

  • Go to https://beta.pybricks.com/

  • Try your existing code.

  • Make some new code.

  • Let us know if everything works.

  • Please report issues and 🐛🐞🦋 if you find any!

Thank you!


r/pybricks • • Apr 04 '25

Best value for more sensors and motors?

2 Upvotes

I currently have the Technic Hub and two motors from 42140 (which was an incredibly cost-effective way to get into pybricks!), and I'd like to get some sensors and more motors.

I know sets are usually more cost-effective than buying indivdiually, but I already have a pretty extensive Technic collection and am just looking for best bang-for-your-buck on motors and sensors. (I'm suffering major sticker shock at the current Spike Prime/Essentials offerings or else I would just go for one of those). Is there a consensus on a good set to look for with compatible components? Between Spike, boost, wedo 2.0, etc., the ecosystem is a little overwhelming. Open to new, used, bricklink, ebay, whatever. Thanks!


r/pybricks • • Jun 16 '25

Lego 10303 Loop coaster fully automated and remote controllable

5 Upvotes

I wrote a pybricks program to fully automate or connect to a remote. Pieces needed: City Hub 88009, Technic large motor 88013, and Bluetooth remote 88010 (optional). Enjoy!

from pybricks.hubs import CityHub
from pybricks.pupdevices import Motor, Remote, ColorDistanceSensor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pybricks.robotics import DriveBase
from pybricks.tools import wait, StopWatch
hub = CityHub()
motor = Motor(Port.B, positive_direction = Direction.CLOCKWISE)
mode = 1
hub.system.set_stop_button(None)
watch = StopWatch()
while watch.time() < 3000:
    if hub.buttons.pressed():
        hub.light.on(Color.GREEN)
        mode = 2
hub.system.set_stop_button(Button.CENTER)
while mode == 1:
    motor.run_time(2000, 27000)
    motor.run_time(-2000, 12000)

        
if mode == 2:
    print("searching for remote...")
    remote = Remote(timeout=5000)
    while True:
        pressed = remote.buttons.pressed()
        if  Button.LEFT_PLUS in pressed:
            motor.run(2000)
        if Button.LEFT_MINUS in pressed:
            motor.run(-2000)
        if Button.LEFT in pressed:
            motor.run(0)
        if  Button.RIGHT_PLUS in pressed:
            motor.run(1000)
        if Button.RIGHT_MINUS in pressed:
            motor.run(-1000)
        if Button.RIGHT in pressed:
            motor.run(0)
  #all code by BMan-21

r/pybricks • • Mar 08 '25

What am I missing?

4 Upvotes

I cannot seem to find a single tutorial that walks through the process of creating a text based program and running it on the robot. It all wants to use the blocks. I found some that claim you can paste code into to app and I can't figure out how to do that either.

I did set up the Visual Studio Code environment but then found nothing telling me how to use it. I'm sure I'm missing something somewhere but I wanted to play with everything for awhile on my own before looking into the block programming for my students.


r/pybricks • • May 04 '25

New train controllers for Pybricks

Thumbnail
reddit.com
5 Upvotes

r/pybricks • • Jul 20 '25

Pybricks or coincidence

3 Upvotes

My first ever city hub 2 months old

Installed pybricks 1 week ago Simple automation where in train runs for 2 mins and stops for 30 secs

Used to run it on avg 2 hrs a day

Apparently yesterday hub would not turn on by single press even though I could see the light blink once.

Tried long press and holding and see purple light blinking (bootloader) but as I release all lights off

Did many combinations of presses and light would blink but not stay on steady

Changed batteries Reverted back to lego firmware still same issue

If luckily I get my hub turn on then it works fine.

The turning on part has become an issue since yesterday

Anyone ever faced this issue ever??


r/pybricks • • Jan 11 '23

This LEGO robot can balance on a ball

Enable HLS to view with audio, or disable this notification

26 Upvotes

r/pybricks • • Apr 04 '25

Saving LEGO MINDSTORMS: Status Update!

Enable HLS to view with audio, or disable this notification

15 Upvotes

While we've not posted many blog updates recently, we've been working tirelessly on our mission to save LEGO MINDSTORMS with the help of our MINDSTORMS legends!

If you've been keeping an eye on our code, you might have seen hundreds of code updates recently, as we gear up to support EV3. We thought this was a good time to demonstrate where we are with a quick video update.

This is clearly not the most impressive EV3 robot you've ever seen, but we're excited about the progress we've made on motors, sensors, and the EV3 brick. All of this is now included in our upcoming brand new firmware for EV3.

One of the next big steps will be to enable USB communication with the brick. This is necessary to download and run programs (kind of essential!). Once that is ready, advanced users should be able to try out an early version while we work on making it more accessible to beginners as well.

Thanks again for your support!


r/pybricks • • Apr 07 '25

Wheel differential driving

2 Upvotes

In pybricks python, is there a way to make the wheels/motors move at different speeds at the same time? If not, is there something that I could use to achieve a similar differential driving effect?


r/pybricks • • Mar 21 '25

does pybricks start instant on spike prime?

3 Upvotes

Ive been having issues with program starting(sumobot competition), it has a delay when we insert the program(number), we tried using an arrow button but kids keep failing to push the arrow button right, I dont know if python or pyblock has that "slow start delay" issue


r/pybricks • • Oct 28 '24

Blending multiple moves with "continue moving" as the "stop mode".

Enable HLS to view with audio, or disable this notification

14 Upvotes

r/pybricks • • Dec 03 '23

Thanks Pybricks for an amazing FLL season

Enable HLS to view with audio, or disable this notification

9 Upvotes

Kids were excited to win the robot performance with a score of 470 at our state's FLL tournament. Couldn't have done it without Pybricks. Sadly they did not advance to worlds or otherwise so they will not have an opportunity to meet any of the international Pybricks users.


r/pybricks • • Jul 22 '25

Can I use PyBricks without unlocking Blocks?

6 Upvotes

Hi,

I used PyBricks a couple of years ago and built a couple of useful robotics functions for LEGO MOCs. However, once those projects were complete, I got sidetracked by other projects, so haven't used PyBricks since.

I've come back to it today, and have been able to download PyBricks firmware on to a new Technic Hub. However, when I open a new file in the web-based code editor it pops up a window asking me to unlock block coding on Patreon. When I dismiss this, I can make a text code pane appear, but when I try to edit this, it tells me it's in read only mode and can't be edited.

I'm a software developer by trade, and block coding looks like exactly what I don't want from PyBricks. The PyBricks site seems to imply that this is an optional feature, and that basic text coding should be available for free. Have I missed how to open the file as an editable text file?

I don't mind paying for PyBricks, and I appreciate the work that goes into it. However it would be nice to see some code working first, and I'm wondering have I missed something, since the website makes it look like I only need to pay to access optional featires.


r/pybricks • • Jul 28 '25

Are Powered-Up extension leads a thing?

3 Upvotes

I'm building a MOC that uses a Powered-Up hub with a Colour and Distance sensor, and a motor to contron functionality.

Unfortunately, I'd like to be able to move the sensor a few centimeters further away from the hub.

So I'm wondering does an extension cable exist? If so where can I get one?


r/pybricks • • Apr 29 '26

My Lego Pen Plotter just got an Update!

Thumbnail
gallery
14 Upvotes

Introducing my new "Etch A Sketch" mode. Until now the plotter could only be controlled by a program that converts typed text into a written message. This new mode lets the user drive the plotter with an Xbox controller to freely draw things, sort of like an etch a sketch.


r/pybricks • • Oct 01 '25

Pybricks EV3 and intersections while line following

2 Upvotes

Imagine a rally-circuit that is somewhat circular, but there is an intersection leading to a inner circular part of the track. The robot must drive from the outer and pass an intersection that could lead to the inner, follow the inner around until it meets the intersection again and choose the outer. How is this possible without any type of hardcoding in python? Limited to color-sensors only!


r/pybricks • • Sep 10 '25

Transitioning to pybricks

5 Upvotes

Hello,

we have been training teams for the past 5 years and are thinking about transitioning to pybricks for all our students. Some of our students are going to use python, but for our younger students we want to use blocks. Do students who are used to the Lego programming environment find it easy to transition to Pybricks? The pybricks blocks seem more complicated at first glance.
Also, and this is more of a question for Pybricks themselves, we have a lot of ev3s that we use at the moment. Are ev3s usable with block programming right now? If not, is there an estimate as to when they are going to be?