Nano RP2040 can't control servo?

Hi,

I'm trying to run this code

import time
import board
import pulseio
from adafruit_motor import servo        # https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries

pwm = pulseio.PWMOut(board.D5, frequency=50)

# servo = servo.Servo(pwm, min_pulse=750, max_pulse=2250)
continuous = servo.ContinuousServo(pwm, min_pulse=750, max_pulse=2250)

but I get the error...

AttributeError: 'module' object has no attribute 'PWMOut'

I've downloaded the newest CircuitPython libraries from CircuitPython Libraries | Welcome to CircuitPython! | Adafruit Learning System, and I copied:

  • adafruit_motor/
  • adafruit_motorkit.mpy
  • adafruit_servokit.mpy

...to the lib/ folder on my CIRCUITPY drive, but that didn't help.

Any idea why I can't set up PWM?

Thanks,
Ryan

It seems like the library has been renamed, try replacing import pulseio with import pwmio and the related calls

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.