How to use adafruit_servokit Library and use GPIO pins

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
carlos144green
 
Posts: 6
Joined: Sun Oct 10, 2021 7:07 pm

How to use adafruit_servokit Library and use GPIO pins

Post by carlos144green »

Hello, I have been struggling because of the library adafruit_servokit https://circuitpython.readthedocs.io/pr ... t_servokit has been stopping me from assigning pins. When I try to do this:

Code: Select all

from adafruit_servokit import ServoKit # Servo library that works with Jetson
import RPi.GPIO as GPIO                # Part of PWM DC motor control 
GPIO.setmode(GPIO.BOARD)               # Error here
It returns an error saying this:

Code: Select all

Traceback (most recent call last):
  File "brew.py", line 4, in <module>
    GPIO.setmode(GPIO.BOARD)
  File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 317, in setmode
    raise ValueError("A different mode has already been set!")
ValueError: A different mode has already been set!
I just need a way to control my servos and use my GPIO pins

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: How to use adafruit_servokit Library and use GPIO pins

Post by adafruit_support_carter »

Part of setting up to use the servokit library was installing Blinka. With that in place, you can access digital pins like this:
https://learn.adafruit.com/circuitpytho ... igital-i-o

Output:
https://learn.adafruit.com/circuitpytho ... 2993446-16

Input:
https://learn.adafruit.com/circuitpytho ... 2993449-19

User avatar
carlos144green
 
Posts: 6
Joined: Sun Oct 10, 2021 7:07 pm

Re: How to use adafruit_servokit Library and use GPIO pins

Post by carlos144green »

Omg, thank you so much! I spent 3 days stressing over this and if I could physically kiss you right now I would.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”