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

StepMotorAtSpeed vs TurnMotorAtSpeed

Mar 18, 2015 at 2:29 AM
I have a scenario in my app in which I want a motor to turn until I tell it to stop, so I tried using the following lines of code to start it:
Me.MyBrick.BatchCommand.TurnMotorAtSpeed(OutputPort.A, 25)
Await Me.MyBrick.BatchCommand.SendCommandAsync()
However, this is not starting the motor. But if I replace it with the following:
Me.MyBrick.BatchCommand.StepMotorAtSpeed(OutputPort.A, 25, 360, True)
Await Me.MyBrick.BatchCommand.SendCommandAsync()
It works fine (except that it only turns the 360 steps that I told it to). I am using the Source Code modification at:
Is there a change in this code that is causing this problem? Has anybody else been having this problem? Thanks.
Mar 19, 2015 at 5:31 PM
I still don't know why
Me.MyBrick.BatchCommand.TurnMotorAtSpeed(OutputPort.A, 25)
didn't work, but I found an alternative that is almost as good (I guess I missed it before):
Me.MyBrick.BatchCommand.TurnMotorAtSpeed(OutputPort.C, 25)
The StartMotor method seemed to work, although I still needed to call TurnMotorAtSpeed to make sure it used the speed I wanted (and possibly other methods such as StepMotorAtPower followed by StopMotor to set the power, etc.), since StartMotor just uses the current settings. It would be nice to be able to set these things in StartMotor (or a method that was not designed to start the motor), but at least this is a workaround that seems to work for now. Hopefully if anybody else was having this problem this helps you too.