How to set up drive base in a library file to be shared by multiple files? #2352
-
|
To compete in FLL, it's normal to have multiple program files, each does its own thing. However, they all share the same hub and drive base, so it's best practice to have one place configure the base and be shared by all files. I know how to do it in Python code. But how to achieve the same effect using the graphic block UI? For example, I defined the following in library.py. How to make these variables visible and usable in program files? Background: I'm coaching a bunch of 6th graders and we started using Pybricks this year for FLL competition. Since the team members are so young, they don't know much about Python programming. They can only use graphic block UI. Thus things that can be straightforward in Python becomes harder. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
|
We do this with python text coding. If you are careful in setting up a base class, the kids won't even know that they are using classes or any "advanced" python features. I have my senior kids work on the python base class over the summer, where we focus on making the code as simple to use as possible. That way when the new sixth graders come in at the beginning of the season, it's no big deal. I ask the new kids every year if they thought learning to program a robot using python was easier or hard than they expected, and they always say easier. Well, the programming itself is easy. Getting the program to make the robot do exactly what they were thinking, well, that's a different story. Here's a link to a tutorial of how we got it all set up. https://github.com/MrGibbage/fll-pybricks-vscode-tutorial |
Beta Was this translation helpful? Give feedback.

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:
The blocks program looks like this: