In
part 2 of this series we had a general look around inside the hub and today we
will build upon that and delve a little deeper.
In part 2 we imported hub and investigated some of its
methods. But what else is on the hub? At the command line type dir(). If you do not see all of the libraries in the screenshot, you can import them.
The result shows that as well as hub, there is also 'mindstorms', 'micropython' and two other libraries. Remember if you want to access one of them you must import it first. Let’s start with import mindstorms.
The using the same trick as yesterday type mindstorms. (don’t forget the full stop/period) and press the Tab key on your keyboard to see what is beneath it.
The result is a list of libraries that should be familiar – some
of these are imported at the beginning of each Python by default on the app. If you dig into any of these eg Mindstorms.ColorSensor
and press Tab, you will see a list of methods – most of which are documented in
the Knowledge Base section of the app.
But there are a few that are not.
I think my next project might be to search through these and document
them so that I have a full list of methods.
There is a lot to explore here, but I think you know the
process by now. If you find anything interesting,
please leave a comment below!
Comments
Post a Comment