Nano RP2040 can't control servo?


I'm trying to run this code

import time
import board
import pulseio
from adafruit_motor import servo        #

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 the lib/ folder on my CIRCUITPY drive, but that didn't help.

Any idea why I can't set up PWM?


have you solved this problem yet? if you have solved this problem can you tell me how you did it?
Thiết bị an khánh