I’m following the example code on the site below on a nano sense ble board.
from machine import Pin, PWM, ADC
pwm = PWM(Pin(15))
duty = 30000 #between 0-65000
pwm.freq(1000)
while True:
pwm.duty_u16(duty)
This is the execution output.
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ValueError: PWM period must be within 16000 cycles
MicroPython: v1.18-omv OpenMV: v4.3.0 HAL: v2.0.0 BOARD: Arduino Nano 33 BLE SENSE-NRF52840
Type "help()" for more information.
>>>
In the module import syntax, Pin and ADC are colored, but PWM is the default text color.
Even if I change the pwm duty value from 30000 to 16000, the result is the same.