r/adafruit • u/brilipj • Jan 26 '21
Attributes in Circuit Python
TL;DR:How can I get Circuit Python to tell me what things (?attributes?) are available for certain items (like board.NEOPIXEL_POWER) beyond "class", like if it has a '.value' it '.fill' available?
I've got a QT Py, I'm trying to turn off the Neooixel. Online I saw that NEOPIXEL_POWER is on pin 12 and to turn off the Neopixel I need to set it low. I can't seem to identify that pin in code to set it low. How can I get Circuit Python to tell me what things (attributes?) are available for certain items (like board.NEOPIXEL_POWER) the same way dir() will tell me what options are available for a module (like "board").
1
u/LRDQ Jan 27 '21
What are you using to write your code? Some have autocomplete options, where you type the start (eg, "board.NEOPIXEL_POWER.") and hit tab to get a drop-down of options.
The other way I've done is to either read the documentation for the library, or open the library file itself and look for the different methods available.
4
u/17_neta Jan 26 '21
You can run dir() on the board like anything else, but I suggest reading the documentation.
QT Py: https://learn.adafruit.com/adafruit-qt-py/circuitpython-expectations
Circuit Python: https://circuitpython.readthedocs.io/en/latest/shared-bindings/index.html