Automate Your LEGO City Trains with Python
ฝัง
- เผยแพร่เมื่อ 15 ก.ค. 2024
- Subscribe 👉 bit.ly/subBlockParty
Join 👉 bit.ly/joinBlockParty
First time here? 👉 bit.ly/newToBlockParty
As a former Computer Science teacher I love the idea of using code to automate my LEGO City, with the ultimate goal being to create the first "Smart Lego City" on TH-cam! Step one is using Python and Pybricks to automate my trains and trams. What should I try next?
Check out our previous video here 👉 • Shopping at EVERY LEGO...
The Pybricks tutorial I mentioned in the video 👉 • How to make smart Lego...
Join our LEGO Discord here 👉 / discord
Find our other channels here 👉 linktr.ee/lollujo
For business enquiries, contact 👉 kevin.mgmt@ritualnetwork.com
Links posted may be affiliate links.
Automate Your LEGO City Trains with Python
Automate Your LEGO City Trains with Python
Automate Your LEGO City Trains with Python
#LEGO #BlockParty #LegoCity
My only advice is just a personal taste thing, in that the train seems too long for the space. I'd try to find a smaller one if I could. But you do you.
That train is only a placeholder until the new tram comes out in August
You should do a random wait time, say between 1 and 6 minutes under the platform to make it feel like a more realistic schedule of different train routes!
Excellent shout!
@@blockpartyukyou could also randomly choose the direction it goes when it stops underneath so it looks like trains are going both directions
That sounds like a plan
Massive fan of pybricks, I have a lengthy code for the Hogwarts express train that goes between hogsmeade and kings cross brick built mocs but it stops at the stations, accelerates gradually out of the stations based on a graph equation, runs at a top speed, decelerates into stations and waits at the station for a few minutes a time. Can also be controlled with the Lego controller. It also uses 2 motors that communicate with each other. My ultimate train code and great to bring out at Christmas. I don't have a Lego city but it's so great!
That sounds awesome!
The city is coming along nicely! Great vid as always
Thanks!
This is awesome stuff. LEGO trains that constant runs is just annoying but this is great.
This is actually really helpful for smaller cities, so the train hides for a couple of minutes before popping up again.
City is looking good, and loving the train, wish I had space for something like that.
Hi kevin be careful with the train stopping under the city it might get stuck, also when you do the beach can you people building sand castles somehow and is there a chance off some animals in the beach area would love too see some birds or maybe some fish in the sea area love seeing the great things you get up too enjoy look forward too seeing the finished piece
Exciting work! Looking forward to any updates on this subject.
Thanks for showcasing Pybricks! And thanks for becoming a supporter.
Pro tip: try placing the sensor a bit closer to the track. It's quite a bit more reliable that way.
You can tell it's about right when the colors at the top at 5:35 look almost like proper colors, rather than those darker shades.
I’ll have a play around, cheers!
The city is growing so fast, I love it!
Great video as always Kev!
Yes! Thank you!
I would really like to see some videos about the coding, this is something I would like to do to my city! Great videos by the way!
Noted!
IDEA: why don’t you program a random time delay for when it’s under the upper level? That way it would be extra special when it pops out! A nice little coding challenge too. Love the vids. All the best.
Definitely going to be adding that in, a few people have suggested it, it’s a great idea!
nicely done
Cheers
Looks great! What made you change your mind about having the train go round the back on the bottom level? I know you were worried in case it derailed and you wouldn’t be able to access it
I decided to have the one of the top level shuttling back and forth and didn’t want them both doing the same thing. If it derails I’ll just have to move some stuff around!
Should make upper level of city into tramline instead of train, Good work so far 👍
I think the tram will be on the lower level because the track is already embedded into the road and the train that’s currently there will move to the upper level
You’ll be moving it all up into the loft soon!!
Now there’s an idea…
Can you make the delays random within specified limits so it waits for a minimum of 1 minute and a maximum of 2 minutes?
Yes, will look into doing that
Have sent to Bricksie, think he will love this!!
Well if he needs any help setting it up, I'm happy to go and be his little helper for a few days!
@@blockpartyuk I'll carry your bags!!
Very cool
It really is, I keep thinking of all the different possibilites now!
Would it be possible to have 2 trains under the platform. One on a linked siding so that when the first train stops the other one starts up and does its thing. This process would continue to alternate between the 2 trains. I know it would take up more room under the platform but it looks like you might have the space?
It’s definitely possible. I’ll have a ponder.
You can make the trains talk to each other so they can pass at a station: th-cam.com/video/n7kxz8-DZwA/w-d-xo.html
Probably a dumb question but do you need to keep your laptop on/ connected to the train for it to run? Can you just turn the train off and then on again and it'll keep running to your program?
Not a dumb question at all - I don’t actually know the answer!
You can! The Pybricks program is saved on the hub. So even with the PC off, you can just start the train again with the button on the hub. This is the biggest different with the official powered up app, where you can't do that.
Rodoror
Hey! I've been watching your channel since your Brick Fest video (shocked at how bad it was!). I hadn't realised you had a background in computer science! I work at a UK company that makes programmable electronics, and we have something coming up that may be of interest to you. Do you have any contact details?
Best way to contact me is the email address in my bio.
@@blockpartyuk Ah, thank you! It seems that detail is not visible on mobile, only on the desktop site
🤗😙😱😙😙😜
,dlc,dl
I'm not best at computers. Is there a stupid gide
The video I linked to in the description is very step by step
Rlrkkrkfkrkf
Kekdkdk