Train with two Powered Up hubs I'm building a motorized train. The locomotive has two Powered Up train motors, one at each end. However, no matter where I place the hub inside the locomotive, the wires on the train motors are too short to both reach the hub.
So, I have decided to try to connect each motor to a separate hub. The problem is that the motors have to spin in the opposite direction. I know that if I put one motor on the &quot;A&quot; output of one hub and the other motor on the &quot;B&quot; output of the other hub, then I can control the motors independently, but I was wondering if there was a way to program the hubs so that I can control both motors together. Is this possible? If so, what would an example program look like to do this? I can also program in Python and Java if that helps at all. Below is a picture of my current setup.
Yes, what you require is perfectly possible to implement in the Powered Up app on nearly any recent smart device.
You do need to program a bit, there's a graphical programming interface which you can get to after tapping the &quot;Create&quot; button.
Since you mention that you're experienced with actual programming languages like Python and Java, you should have no difficulty figuring out what the code blocs do.
You'll have the option to either work with sliders that will be present on some makeshift GUI on your smart device to control the speed, or you can chose to connect a remote as a third device (the other two devices being the hubs) and work with the input from the remote...
Addition: I've found the following example program on reddit:

It's a successful attempt to control the train with the remote just like when the remote would be connected directly... it maintains a variable with the speed of a the train, which can be increased or decreased with the + and - buttons on the train remote, and then the speed is set to the motor. The only change you would need to make is setting the negative of that speed on the second train motor which will be connected to the second hub.
That hub will be the third device connected, which is important for the port selection in the code blocks...