pulseio.PulseOut(pin, ...) refuses on every pin except D3 (the ATmega328p's OC2B):
import board
import pulseio
pulse = pulseio.PulseOut(board.D9, frequency=38000, duty_cycle=32768)
error: CompileError: a pulse train's carrier comes out of OC2B, which is PD3 (D3 on an
Arduino Uno) ...
This is a deliberate hardware constraint (Timer2 fast-PWM mode 7 is the only carrier
generator this HAL wires up, per pymcu/hal/avr/pulse/atmega328p.py) and the message
explains it well -- but the README's pulseio row ("Pulse lengths in microseconds; a 38
kHz carrier gated by a pulse list") never says PulseOut is pinned to one pin. A user
following an Adafruit IR-blaster guide, which typically wires the emitter to whatever
pin is convenient, hits this only at build time.
Ask
Add "PulseOut only drives D3 (OC2B) on this chip" to the pulseio row / known
limitations list, alongside the other AVR-specific pin constraints already documented
there (e.g. countio needing D2 or D3).
Corpus program (pymcu-circuitpython test corpus)
40_pulseout_wrong_pin_refuse.py -- pulseio.PulseOut(board.D9, ...).
pulseio.PulseOut(pin, ...)refuses on every pin except D3 (the ATmega328p's OC2B):This is a deliberate hardware constraint (Timer2 fast-PWM mode 7 is the only carrier
generator this HAL wires up, per
pymcu/hal/avr/pulse/atmega328p.py) and the messageexplains it well -- but the README's
pulseiorow ("Pulse lengths in microseconds; a 38kHz carrier gated by a pulse list") never says PulseOut is pinned to one pin. A user
following an Adafruit IR-blaster guide, which typically wires the emitter to whatever
pin is convenient, hits this only at build time.
Ask
Add "PulseOut only drives D3 (OC2B) on this chip" to the
pulseiorow / knownlimitations list, alongside the other AVR-specific pin constraints already documented
there (e.g.
countioneeding D2 or D3).Corpus program (pymcu-circuitpython test corpus)
40_pulseout_wrong_pin_refuse.py--pulseio.PulseOut(board.D9, ...).