A helper library to make it easy to access core PyCubed functionality and illustrate how to interact with the hardware.

↩ Return Home

↩ Return to Resources

↩ Return to Code Examples


In this Section

The pycubed.py library is an extremely useful resource for operating the board. It's also a good introduction to writing your own libraries or functions.

<aside> 💡 CircuitPython libraries are plain-text files. Meaning you can always open the pycubed.py file to remember and learn from the functions.

</aside>

⚙ Hardware Needed


📚 External Libraries Needed


pycubed.py


📑 Example Usage


Calling the library

(return ⬆)

The pycubed.py library is always invoked by importing the "cubesat" object as shown below:

from pycubed import cubesat

This is usually done at the start of your main.py file (or whatever script you're writing). But it also makes it easy to interact with the board from the REPL:

>>> from pycubed import cubesat
[ERROR][SD Card] no SD card
[WARNING][RADIO #2] Failed to find rfm9x with expected version -- check wiring
>>>

However you are working with the board, you should always start with: from pycubed import cubesat if you intend to use the pycubed.py helper library.

Checking available on-board hardware

(return ⬆)

from pycubed import cubesat
print(cubesat.hardware)

Controlling the RGB LED (aka NeoPixel)

(return ⬆)

Simple property that lets you set the color of the RGB LED using a tuple in the format of (RED,GREEN,BLUE). Values can only be 0→255. The full adafruit_neopixel library is accessible from the cubesat.neopixel object. See adafruit_neopixel→ for more details.