Answers.Body: <p>Based on the answer to <a href="https://bricks.stackexchange.com/questions/10367/what-is-inside-the-lego-powered-up-m-motor">this question</a> 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 &quot;Run with power X&quot;. 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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-24T20:45:45.400Z
Answers.LastActivityDate: 2020-07-24T20:45:45.400Z
Answers.UserDisplayName: Jan
Body: <p>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 <a href="https://www.dynamsoft.com/codepool/lego-wedo-motor-python-gui-linux.html" rel="nofollow noreferrer">what is being done on this link</a>, just (so far) more ugly and less sophisticated. For reading the sensor values, I got some really useful hints from <a href="https://www.heise.de/ct/artikel/Spielzeug-Roboter-mit-dem-Raspberry-Pi-steuern-4248807.html" rel="nofollow noreferrer">this German-language article</a>.</p>
  <p>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).</p>
  <p>I have tried this:</p>
  <ul>
  <li><p>I have tried using some of the commands mentioned in <a href="https://lego.github.io/lego-ble-wireless-protocol-docs/index.html" rel="nofollow noreferrer">this piece of documentation</a>. 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.</p>
  </li>
  <li><p>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 &quot;real&quot; 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.</p>
  </li>
  <li><p>I have tried using the LegoDeviceSdk. But this does not seem to offer anything beyond &quot;turn with power X&quot; either.</p>
  </li>
  </ul>
  <p>Any ideas how I could get a motor position, or make the motor rotate to a desired position?</p>
  
Tags: <programming><powered-up><bluetooth><wedo>
Title: Any way to get the current motor position or angle in WeDo 2 (when accessing hub via BLE protocol)?
UserDisplayName: Jan
ThreadText: # Any way to get the current motor position or angle in WeDo 2 (when accessing hub via BLE protocol)?
  
  (Asked by: username_0 on 2020-07-23)
  
  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](https://www.dynamsoft.com/codepool/lego-wedo-motor-python-gui-linux.html), just (so far) more ugly and less sophisticated. For reading the sensor values, I got some really useful hints from [this German-language article](https://www.heise.de/ct/artikel/Spielzeug-Roboter-mit-dem-Raspberry-Pi-steuern-4248807.html).
  
  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](https://lego.github.io/lego-ble-wireless-protocol-docs/index.html). 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?
  
  **Tags:** programming, powered-up, bluetooth, wedo
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-07-24. Score: 4
  
  Based on the answer to [this question](https://bricks.stackexchange.com/questions/10367/what-is-inside-the-lego-powered-up-m-motor) 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.
  
  
  ---
  
  