Skip to content
Discussion options

You must be logged in to vote

Hello,

I tried to get a small thing setup with your snippet.
No rocket science, but maybe a hint for you.
It does nothing but turn the wheels a bit.

Made a python file issue_2352_library:

# import the needed modules
from pybricks.hubs import PrimeHub
from pybricks.pupdevices import Motor
from pybricks.parameters import Axis, Port, Direction
from pybricks.robotics import DriveBase

def define_devices(XX, YY):
    prime_hub = PrimeHub(top_side=Axis.Z, front_side=Axis.X)
    rightwheel = Motor(Port.A, Direction.CLOCKWISE)
    leftwheel = Motor(Port.B, Direction.COUNTERCLOCKWISE)
    drive_base = DriveBase(leftwheel, rightwheel, XX, YY)
    return drive_base

The blocks program looks like this:

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@fancooling
Comment options

Answer selected by fancooling
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
software: pybricks-blocks Issues with blocks and code generation
3 participants