0

Modules / functions for CircuitPython
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Modules / functions for CircuitPython

by drtomsutherland on Mon Feb 11, 2019 10:03 am

How do I find current listing for Modules/functions/Modes/etc... fro CircuitPyhton? I have been following the examples and they lead you down a path telling you how to do a specific thing, like sending a pwm to a servo. The example below says you create an servo and write your angle to servo.angle. How do I know what properties are available in servo. ? servo.angle is just one, are their others? Same goes for pulseio.XXX

example from: https://learn.adafruit.com/using-servos ... cuitpython
import time
import board
import pulseio
import adafruit_motor.servo
# Initialize PWM output for the servo (on pin D5) and servo:
pwm = pulseio.PWMOut(board.D5, frequency=50)
servo = adafruit_motor.servo.Servo(pwm)
servo.angle = 0

drtomsutherland
 
Posts: 5
Joined: Wed Jan 23, 2019 3:43 pm

Re: Modules / functions for CircuitPython

by millercommamatt on Mon Feb 11, 2019 1:17 pm

If it's an adafruit library, you'll likely have to read through the source code yourself.

https://github.com/adafruit/Adafruit_Ci ... thon_Motor

millercommamatt
 
Posts: 342
Joined: Tue Jul 31, 2018 4:57 pm

Re: Modules / functions for CircuitPython

by adafruit_support_carter on Mon Feb 11, 2019 1:42 pm

The CircuitPython documentation is hosted on Read The Docs. One way to get there is to click on the doc badge in the library's repo readme:
rtd.jpg
rtd.jpg (18.8 KiB) Viewed 63 times


In the case of the Motor library, that'll lead you here:
https://circuitpython.readthedocs.io/pr ... en/latest/
and then you can look at the documentation for servo:
https://circuitpython.readthedocs.io/pr ... otor-servo

Another way to do a quick check in CircuitPython is to use the dir command, once you've created the servo object:
Code: Select all | TOGGLE FULL SIZE
dir(servo)

adafruit_support_carter
 
Posts: 11091
Joined: Tue Nov 29, 2016 2:45 pm

Re: Modules / functions for CircuitPython

by drtomsutherland on Mon Feb 11, 2019 1:53 pm

How do you find other libraries besides the Motor library? Like board, pulseio, time, etc... Is there a listing of all of them?

drtomsutherland
 
Posts: 5
Joined: Wed Jan 23, 2019 3:43 pm

Re: Modules / functions for CircuitPython

by adafruit_support_carter on Mon Feb 11, 2019 2:18 pm

In general, should be the same for other libraries. Should be able to follow that link to get to Read The Docs.

However, there's a special set of libraries that are "built in", which are called the core modules, and "board" is one of those. Since those are considered to be part of CircuitPython itself, look here:
https://circuitpython.readthedocs.io/en ... index.html

We don't have a single list of all the other libraries. It's constantly evolving. You can get a list of sort by looking in the library bundle repo here:
https://github.com/adafruit/Adafruit_Ci ... es/drivers
Each one of those is a link to an actual library repo.

adafruit_support_carter
 
Posts: 11091
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.