Pybricks lets you run MicroPython scripts on the hub. Once loaded onto the hub, you can just start the script again by pressing the button. No constant connection required.
You can even add sensors that count the track sleepers so you can get a constant speed no matter the load. Here's a demo with code.
Comments
Yes, you can automate LEGO trains with Pybricks. See https://beta.pybricks.com/
Pybricks lets you run MicroPython scripts on the hub. Once loaded onto the hub, you can just start the script again by pressing the button. No constant connection required.
You can even add sensors that count the track sleepers so you can get a constant speed no matter the load. Here's a demo with code.
https://pybricks.com/projects/sets/city/60198-cargo-train/sp...
You can also automate the switches so you can get pretty creative with your layouts:
https://www.facebook.com/Pybricks/videos/989683888156075
With enough supporters, we may eventually even add a block-coding language as an alternative to MicroPython.