How to automate LEGO trains using original LEGO pieces (and Python)

Ғылым және технология

In this video I show how to use PyBricks to program a train and a train car to use a sensor for automation. Hub-to-hub communication using Bluetooth is used to tell the cars when to open their doors.
LEGO Train used in this video: www.lego.com/en-us/product/ex...
Sensors:
www.bricklink.com/v2/catalog/...{%22iconly%22:0}
and
www.bricklink.com/v2/catalog/...
Project for the code: github.com/LasseD/PybricksPro...
The code is written using PyBricks: code.pybricks.com/
Chapters:
0:00 Speed Building
1:36 Show the standard functionality
2:06 Build in a sensor
2:30 Remove the lights
2:36 Colors to detect
2:45 Code for color detection
3:00 Color detection
3:11 Code color sensing
3:18 Which colors are uniquely detected?
3:24 Use colors to command the train
3:44 Slow and fast driving
4:02 Stop at a station
4:46 Expand the station
5:05 Motorize the doors
6:10 Code the hub-to-hub communication
6:18 Code for the train car doors
6:48 Failed test due to non-ending broadcast
7:21 Mechanical fix (swap a motor)
7:34 Code fix to halt broadcast signal for doors
7:50 Testing
8:48 Expand the track
9:17 Failed test for reversing
9:38 Reversing is added to outer track
9:44 Fail due to cable having too little space between cars
9:57 Fix of car buffers
10:04 Final testing of all features

Пікірлер: 12

  • @Snuggles_the_Unholy
    @Snuggles_the_Unholy19 күн бұрын

    For me, the most satisfying thing about these builds is that lego-snap. It has a nice ASMR feel.

  • @mattimotion
    @mattimotion19 күн бұрын

    I love how neatly you hid the electronics!

  • @pybricks
    @pybricks19 күн бұрын

    Great video! Nice combination of block-based coding and Python coding :)

  • @TuneStunnaMusic
    @TuneStunnaMusic16 күн бұрын

    Im surprised the switch wasnt automated, pretty cool though

  • @LasseDeleuran

    @LasseDeleuran

    15 күн бұрын

    That shall be fixed!

  • @user-kw7vw4ow2n
    @user-kw7vw4ow2n17 күн бұрын

    Сюда бы CaDa микромоторы для открывания дверей

  • @RohanBeckett
    @RohanBeckett19 күн бұрын

    awesome work - however I can't see the code on your github?

  • @LasseDeleuran

    @LasseDeleuran

    19 күн бұрын

    Thanks. I missed a commit. It has been added now.

  • @RohanBeckett

    @RohanBeckett

    19 күн бұрын

    @@LasseDeleuran thanks for that! I'm working and learning both text and blocks coding - are you able to share the screenshot from your blocks code too?

  • @legomitroman
    @legomitroman17 күн бұрын

    👍

  • @miu92836
    @miu928362 күн бұрын

    いいね!

  • @user-zh2fe8dy7x
    @user-zh2fe8dy7x19 күн бұрын

    Я люблю механизмы

Келесі