
We now have three motors that we are able to use with the powered up system.


Name = req.We take a break from nostalgia today as we return to turn to look at the Powered Up system. Gives as output: name: LPF2 Smart Hub 2 I, address: A0:E6:F8:49:E2:93 Running from gattlib import GATTRequester, GATTResponse, DiscoveryService I do have access to a Windows PC with Lego's children-friendly software on it, which successfully pairs with and controls the motor.Īre there any other models for electric motors that can be perhaps more easily controlled via Python? Both USB or Bluetooth would be fine. (Anyway, the first command would address the hub itself, to change its colors, so even if the motor was connected to the wrong port, the colors should change nonetheless.) In the code req.write_by_handle(0x3d, "\x01\x01\x01\圆4"), the initial \x01 should dictate which port of the WeDo-Hub the motor is connected to, and it is indeed connected to the first port. When using hci1 instead, the dongle flashes quickly for a few seconds, then the error appears:įinally, when I disconnect the dongle and type hci0 in the above code, the error is: RuntimeError: Invalid device!, as I would expect, given that the dongle has been removed.ĭuring all of this, the WeDo engine just shows a constant blue light, indicating that it is connected and waiting for orders. RuntimeError: connect: Device or resource busy (16) Which should change the color of the engine's LED, and spin it a bit, then stop. My Python code is now: from gattlib import GATTRequester > connect A0:E6:F8:49:E2:93 throws "connection successful". The command sudo hcitool -i hci0 lescan shows, when the motor is in pairing mode, the output A0:E6:F8:49:E2:93 LPF2 Smart Hub 2 I. hci0 is the dongle, and hci1 the internal one.

I read a lot about the specific BLED112 USB dongle, which is also recommended by Lego, but I currently just have a generic Bluetooth 4.0 USB dongle.

The Lego WeDo 2.0 "hub" uses a bluetooth low energy technology, and to it, a motor is connected via cable, that I want to spin. I am trying to control the motor of a Lego Wedo 2.0 set via Python from an ubuntu distribution.
