This project has moved. For the latest updates, please go here.

Detecting Current Motor Polarity

Apr 11, 2014 at 10:48 PM
As I mentioned in a previous posting of mine, the SetMotorPolarity method seems to start the motors automatically sometimes. Because the polarity seems to affect the motor direction regardless of which methods you are using, I figured it would be a good idea to reset the polarity for all motors when I connect. At first, I tried the following:

Await Me.EV3Brick.DirectCommand.SetMotorPolarity(OutputPort.All, Polarity.Forward)
Await Me.EV3Brick.DirectCommand.StopMotorAsync(OutputPort.All, True)

I call StopMotorAsync immediately after SetMotorPolarity because, as I mentioned, SetMotorPolarity seems to automatically start the motor. However, because the first line would only start motor A if I removed the second line, I am not sure if it is setting the polarity for all motors or just motor A. Because I could not find any way to detect the current polarity, the only solution I could come up with that I was sure would work was to set and stop each motor individually. This is not complex code, so I don't really care if I need to set and stop them individually, but I would like to be able to detect the current polarity, but even more, I wish the motors would not start automatically when I set the polarity. Does setting the polarity start the motor by design, or is it a side effect or bug? Thanks.
Coordinator
May 26, 2014 at 5:29 AM
As I posted on the other thread just now, it's either by design or a side effect or a bug. :) It exists at the brick level, not the API level, so I'm not sure which it is.