Skip to content

Additional motor with Pybricks - 4X4 X-treme Off-roader #2010

Answered by laurensvalk
LegoMan228 asked this question in Q&A
Discussion options

You must be logged in to vote

That is a nice extension 😄

no success to make it rotate with the same speed in both directions!

Have a look at this piece of your code.

    #4th motor for hook, red buttons
    if Button.LEFT in pressed:
        hook.dc(-100)   
    else:
        hook.brake()

    if Button.RIGHT in pressed:
        hook.dc(100)   
    else:
        hook.brake()

What will it do if one button is pressed, or when both are pressed?

By contrast, what will the following adaptation do?

    #4th motor for hook, red buttons
    if Button.LEFT in pressed:
        hook.dc(-100)   
    elif Button.RIGHT in pressed:
        hook.dc(100)   
    else:
        hook.brake()

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@LegoMan228
Comment options

@laurensvalk
Comment options

Answer selected by LegoMan228
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants