I did the pip --upgrade and than tried to use the pixelWidth option. The fix did repair the “float” issue that caused the initial error when I defined Strip(driver, pixelWidth=x) .
···
===========================================================================
from bibliopixel import *
from bibliopixel.drivers.serial import *
driver = Serial(num = 300, ledtype = “WS2812B”, c_order = “GRB”)
#Now try with Strip
led = Strip(driver, pixelWidth=3)
for i in range(300):
led.set(i, colors.hue2rgb((i*4)%256))
led.update()
input("…")
#turn everything off
led.all_off()
led.update()
===========================================================================
If I set pixelWidth=1 the code runs properly … generates an RGB rainbow acorss all 300 leds.
But if, as is currently in the code above, I use pixelWidth=3 I get the unexpected results.
First the expected result was that all 300 leds would fire up in groups of 3. Instead only the first 100 leds fire up. I did try adjusting the for loop from 300 to 100 and back but no difference.
Second was a failure that occurs when the code exits. The following is what I observed:
===========================================================================
PS C:\Users\hdb47\Documents\hdbcentos6\hbreeden\Documents\Development\Python\Wip\PianoBar-AllPixel> python .\strip1.py
INFO - devices - Using COM Port: COM4, Device ID: 0, Device Ver: 0
…
Traceback (most recent call last):
File “.\strip1.py”, line 18, in
led.update()
File “C:\Python34\lib\site-packages\bibliopixel\layout\layout.py”, line 40, in update
return self.push_to_driver()
File “C:\Python34\lib\site-packages\bibliopixel\layout\layout.py”, line 65, in push_to_driver
self.threading.push_to_driver()
File “C:\Python34\lib\site-packages\bibliopixel\threads\update_threading.py”, line 93, in push_to_driver
self.update_colors()
File “C:\Python34\lib\site-packages\bibliopixel\threads\update_threading.py”, line 83, in update_colors
d.update_colors()
File “C:\Python34\lib\site-packages\bibliopixel\drivers\driver_base.py”, line 100, in update_colors
self._compute_packet()
File “C:\Python34\lib\site-packages\bibliopixel\drivers\serial\driver.py”, line 141, in _compute_packet
self._render()
File “C:\Python34\lib\site-packages\bibliopixel\drivers\driver_base.py”, line 116, in _render
c = [int(level * x) for x in self._colors[i + self._pos]]
IndexError: list index out of range
===========================================================================
Now just to keep this issue in perspective, I did adjust my Python project to manage the pixelWidth so at this point this is not affecting my project.
But I do believe this would be a valuable feature in BiblioPixel so will gladly work with the team to try to fully resolve this particular issue.
Harold
On Wednesday, November 22, 2017 at 9:30:10 AM UTC-6, Harold Breeden wrote:
I am running an BiblioPixel/AllPixelMini with WS2812B 60/m led strip. The application is going to treat 9 leds as a “pixel”, which gives me a 6" wide pixel.
I found in bibliopixel.layout.strip the pixelWidth parameter. Looked to be the perfect solution to allow the BiblioPixel to manage the pixel size.
The Python lines that defines the led strip is:
driver = Serial(num = 297, ledtype = "WS2812B", c_order = "GRB")
led = Strip(driver, pixelWidth=9)
If I set the pixelWidth to anything other then 1, i get the following error:
PS C:\Users\hdb47\Documents\hdbcentos6\hbreeden\Documents\Development\Python\Wip\PianoBar-AllPixel> python .\pianoBar.py
INFO - devices - Using COM Port: COM4, Device ID: 0, Device Ver: 0
INFO - driver - Reconfigure and reboot needed, waiting for controller to restart…
INFO - devices - Using COM Port: COM4, Device ID: 0, Device Ver: 0
INFO - driver - Reconfigure success!
Traceback (most recent call last):
File “.\pianoBar.py”, line 212, in
main()
File “.\pianoBar.py”, line 43, in main
led = Strip(driver, pixelWidth=3)
File “C:\Python34\lib\site-packages\bibliopixel\layout\strip.py”, line 33, in init
self.set_pixel_positions(make_strip_coord_map_positions(self.numLEDs))
File “C:\Python34\lib\site-packages\bibliopixel\layout\geometry\strip.py”, line 56, in make_strip_coord_map_positions
return [[x, 0, 0] for x in range(num)]
TypeError: ‘float’ object cannot be interpreted as an integer
Am I misinterpreting the usage of pixelWidth?
Am I defining pixelWidth improperly?
Or am I just completely off base and just need to have Python manage the 9 leds per pixel?