[Microbit-Python] Which pins can cope with a 35 micro second pwm?

Mark Shannon mark at hotpy.org
Tue Feb 14 15:36:18 EST 2017


Hi Andrew,

For PWM there is only one period. All the pins use the same period, but 
their duty cycles can differ. This is a hardware limit (there aren't 
enough clocks to do otherwise). You can use any of the pins with PWM.

The minimum PWM period is 256µs. It is longer than the DAL variant, as 
we use the internal clock for the audio module (needed for speech).
I can't remember why exactly why 256? I suspect that it is short enough 
for music and long enough to be reliable.
How low a period do you need? 256µs isn't very long.

Cheers,
Mark.

On 14/02/17 18:29, Andrew Stacey wrote:
> I'm not quite clear from the docs which pins can cope with the minimum
> pwm speed.  I just tried with pin1 and couldn't set it below 1000
> microseconds, but I notice from the relevant doc page
> (https://microbit-micropython.readthedocs.io/en/latest/pin.html) that
> only some pins are listed as "analog" (3,4,10).  Is it only those that
> can go down to 35?
>
> Thanks,
> Andrew
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit


More information about the Microbit mailing list