TransWikia.com

Any way to get the current motor position or angle in WeDo 2 (when accessing hub via BLE protocol)?

Bricks Asked on December 2, 2021

I have managed to write a small C# program that lets me play around with the WeDo 2 hub. I can read sensor values or set the speeds of up to two connected WeDo motors independently (I am aware that Lego says that this is not a good idea). The program is slightly similar to what is being done on this link, just (so far) more ugly and less sophisticated. For reading the sensor values, I got some really useful hints from this German-language article.

Anyway, this means it is now almost possible to build a remote controlled car with steering. The only thing that is missing is some way to verify that the steering is in neutral position. For this, it would be practical to have some way to read the current motor position (or angle) and/or to tell the motor to go to a certain position (or angle).

I have tried this:

  • I have tried using some of the commands mentioned in this piece of documentation. However, none of them worked, except plain StartPower(Power). Given that the Guids mentioned in the document were not particularly helpful when trying to make the WeDo 2 hub work as expected, this document may not be very relevant here.

  • I have tried reading sensor values, but I did not get any values for the port that the motor is plugged into. For the two "real" WeDo sensors, one has to perform an initialization before they provide values. I do not know if or how it is possible to initialize the motor in order to provide its current position or angle.

  • I have tried using the LegoDeviceSdk. But this does not seem to offer anything beyond "turn with power X" either.

Any ideas how I could get a motor position, or make the motor rotate to a desired position?

One Answer

Based on the answer to this question and some experiments with other hubs and other motors today (Boost hub + Boost motor + small PoweredUp hub), it seems that the WeDo motors really lack any ability beyond "Run with power X". Given that the WeDo motor is the same model that is built into the Bat Mobile, I would expect that the PoweredUp app would offer more functions for this motor if the motor was capable of them.

Answered by Jan on December 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP