adafruit / adafruit/Adafruit_CircuitPython_seesaw
Setting PWMOut.duty_cycle
- Dominant language
- Python
- Stars
- 68
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
This comments indicate a 16-bit number is expected. If you attempt to set it to a number higher than 255, it throws an error on analog_write. The documentation states these are 8-bit PWMs, so I believe the comments and error checking are incorrect.
`
Traceback (most recent call last):
File "seesaw_readadc.py", line 48, in
pwm1.duty_cycle = 0xFFFF
File "/home/pi/Testing/venv/lib/python3.7/site-packages/adafruit_seesaw/pwmout.py", line 47, in duty_cycle
self._seesaw.analog_write(self._pin, value)
File "/home/pi/Testing/venv/lib/python3.7/site-packages/adafruit_seesaw/seesaw.py", line 348, in analog_write
cmd = bytearray([self.pin_mapping.pwm_pins.index(pin), value])
ValueError: byte must be in range(0, 256)
`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with adafruit_seesaw/pwmout.py and adafruit_seesaw/seesaw.py, following the duty_cycle call into analog_write where the reported ValueError occurs. Verify the intended PWM width against the documentation and device behavior, then make the comments, validation, and observed behavior consistent and confirm the 0xFFFF reproducer no longer conflicts with that contract.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100