-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
HacktoberfestDigitalOcean's HacktoberfestDigitalOcean's HacktoberfestbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Running on a Pi 3 (python 3.7.3).
import board
import adafruit_rgbled
rgb = adafruit_rgbled.RGBLED(board.D1, board.D2, board.D3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python3.7/site-packages/adafruit_rgbled.py", line 110, in __init__
raise TypeError("Must provide a pin, PWMOut, or PWMChannel.")
TypeError: Must provide a pin, PWMOut, or PWMChannel.
This line does not identify pins correctly:
Adafruit_CircuitPython_RGBLED/adafruit_rgbled.py
Lines 104 to 110 in cb62700
if hasattr(self._rgb_led_pins[i], "frequency"): | |
self._rgb_led_pins[i].duty_cycle = 0 | |
elif str(type(self._rgb_led_pins[i])) == "<class 'Pin'>": | |
self._rgb_led_pins[i] = PWMOut(self._rgb_led_pins[i]) | |
self._rgb_led_pins[i].duty_cycle = 0 | |
else: | |
raise TypeError("Must provide a pin, PWMOut, or PWMChannel.") |
>>> type(board.D1)
<class 'adafruit_blinka.microcontroller.bcm283x.pin.Pin'>
Is there a compatible way to actually test if it's a pin ? Just try/except it ?
In Circuitpython a pin is an instance of microcontroller.Pin (for isinstance
), but not currently in Blinka.
If we are going with strings, there's board.D1.__class__.__name__ == "Pin"
?
Metadata
Metadata
Assignees
Labels
HacktoberfestDigitalOcean's HacktoberfestDigitalOcean's HacktoberfestbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers