Ahoy, shipmates!
New user with his first post here.
It’s regarding the fine LED Shim product.
When trying to use the ledshim.set_multiple_pixels() object from the ledshim module.
It returns the following error:
AttributeError: ‘module’ object has no attribute ‘set_multiple_pixels’
Suggesting that this object is not present in the ledshim library?
Looking at the ledshim github issue page, there would seem to be others with a similar issue. Other functions seem to be fine.
Is there a fix, or workaround? Is there any word on this, please?
Thanks!
def set_multiple_pixels(indexes, r, g, b):
for index in indexes:
ledshim.set_pixel(index, r, g, b)
Then do something like this
set_multiple_pixels(range(0,11), 255, 0, 0) # Red
set_multiple_pixels(range(11,16), 255, 140, 0) # Orange
set_multiple_pixels(range(16,28), 0, 255, 0) # Green
# R R R R R R R R R R R O O O O O G G G G G G G G G G G G
That’s great, many thanks for that, alpha. That does indeed return a result.
However, I fear I may have poorly phrased my query.
Forgiveness please for my newbie-ness! I am still getting to grips with Python. :(
I’m trying to use the from_colour and to_colour with the set_multiple_pixels object. Like this within a script:
set_multiple_pixels(range(0, 28), from_colour=(255, 255, 0), to_colour=(0, 0, 255))
Which throws back the following error:
TypeError: set_multiple_pixels() got an unexpected keyword argument ‘from_colour’
As noted in the doc for the ledshim here.
Am I not coding correctly? Is the module and or the library possibly needing a refresh?
Thanks again for any help or guidance. It is greatly appreciated.
That I don’t know? The code above was given to me by Phil @gadgetoid when I asked a similar question.
LED Shim as a thermometer - Support - Pimoroni Buccaneers