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
For me, the most satisfying thing about these builds is that lego-snap. It has a nice ASMR feel.
I love how neatly you hid the electronics!
Great video! Nice combination of block-based coding and Python coding :)
Im surprised the switch wasnt automated, pretty cool though
@LasseDeleuran
15 күн бұрын
That shall be fixed!
Сюда бы CaDa микромоторы для открывания дверей
awesome work - however I can't see the code on your github?
@LasseDeleuran
19 күн бұрын
Thanks. I missed a commit. It has been added now.
@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?
👍
いいね!
Я люблю механизмы