pythongpionvidia-jetsonnvidia-jetson-nanoadafruit-circuitpython

How to use servoKit library and GPIO pins


I have been struggling because of the library adafruit_servokit has been stopping me from assigning pins. When I try to do this:

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:

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 at the same time.

I'm open to buying new parts as well.


Solution

  • Turns out I just needed to use digitalio: https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/digital-i-o