lego-mindstormsmakecode

MakeCode EV3 motor invert not working with motor.xx.tank


I'm using the beta MakeCode for Mindstorms EV3 at https://makecode.mindstorms.com/ and I've found an issue that might be a bug.

I'm using the Motor Invert block to reverse the direction of my motors. When I check the result on the simulator, I see the direction of the motors change, but when I download the .uf2 file to the EV3, the motor's direction of rotation doesn't change. I've tried putting the "inverted" setting to "on" and "off" and I see that affecting the simulation but not on the physical robot.

I tried changing the EV3 output ports but that didn't help.

Here is the Javascript version of my code.

brick.buttonUp.onEvent(ButtonEvent.Pressed, function () {
    brick.setStatusLight(StatusLight.Green)
    motors.largeB.setInverted(true)
    motors.largeC.setInverted(true)
    motors.largeBC.tank(50, 50)
    sensors.touch4.pauseUntil(ButtonEvent.Pressed)
    motors.stopAll()
})
brick.setStatusLight(StatusLight.GreenFlash)

Is there a problem with how I'm reversing the direction of rotation?

As a test I tried replacing the motors.xxxx.tank with motors.xxxx.run and then it does reverse the direction of rotation both on the simulator and the physical robot.

motors.largeB.run(50)
motors.largeC.run(50)

Solution

  • Thanks for reporting this bug.

    It does indeed look like the tank block doesn't respect the inverted state of the motors.

    For now, you can use: motors.largeBC.tank(-50, -50) to reverse the motors using the tank block.

    I've filed a bug on our end to track this issue. Thanks!