Mapping a motor to controller buttons breaks blocks that move that motor

If I map a set of controller buttons to a particular motor, blocks that move that motor no longer have any effect. The blocks get passed over completely, and any subsequent blocks will execute immediately. There does not appear to be any warning or other communication of this behavior in the UI.

1 Like

Yes, that is how it currently works… when neither button is pressed we are sending a “stop motor” command all of the time.

We’ll improve this for 1.0 - we only need to tell the motor to stop once and then user blocks could control the motor from there.

1 Like

You could just assign the action with the code blocks instead of using the controller setup. I actually didn’t notice you could do that until just now!

I did try that. The problem then is the same as @tfriez described - if no button is pressed, the motor is constantly being told to stop, so any other commands to move the motor are ineffective.

My way around that problem was to have a global variable that gets set to 0 normally, and 1 when some non-controller code is moving the motor:

26%20PM

This worked fine but is a bit complicated for new programmers IMO.

What about…

Should have the same effect. If you have code controlling the Arm you would have to put it in the same loop to prevent it from doing the same thing.

image

2 Likes

Yeah, if you do it 100% via code then you can work around it with conditionals. If you do it 100% via the Devices window, you can not worry about the code… but I know an important concept is to be able to blend the two together.

We’ll work it out so it makes sense for the “mixed usage” for the 1.0 release.

2 Likes

You can also use events to trigger behaviors on a specific button press without interfering with the “when started” stack.

07%20PM

2 Likes