Problem with getting info from blinkstick pro with python

I just got my Blinkstick Pro set up with a strip of 60 ws2812b LEDs and when I try to use get_color on any index > 0 or I use get_data, python spits back this error message:

>>> b.get_color(index=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\blinkstick\blinkstick.py", line 414, in get_color
    return get_color_func(index)
  File "C:\Python27\lib\site-packages\blinkstick\blinkstick.py", line 378, in _get_color_rgb
    data = self.get_led_data((index + 1) * 3)
  File "C:\Python27\lib\site-packages\blinkstick\blinkstick.py", line 472, in get_led_data
    device_bytes = self._usb_ctrl_transfer(0x80 | 0x20, 0x1, report_id, 0, max_leds * 3 + 2)
  File "C:\Python27\lib\site-packages\blinkstick\blinkstick.py", line 235, in _usb_ctrl_transfer
    return self.reports[wValue - 1].get()
  File "C:\Python27\lib\site-packages\pywinusb\hid\core.py", line 1519, in get
    self.set_raw_data(raw_data)
  File "C:\Python27\lib\site-packages\pywinusb\hid\core.py", line 1372, in set_raw_data
    byref(self.__raw_data), len(self.__raw_data)) )
  File "C:\Python27\lib\site-packages\pywinusb\hid\winapi.py", line 382, in __init__
    raise helpers.HIDError("hidP error: %s" % self.error_message_dict[error_code])
pywinusb.hid.helpers.HIDError: hidP error: not value array

Before this, I got b using the find_first method, and set the mode to 2.

Also, on a completely unrelated note you guys should make a version of the blinkstick pro firmware (if possible) which uses all the LED data memory for one channel, enabling up to 192 LEDs off that channel.

I’m looking into reproducing this.

It’s not possible to drive more than 64 LEDs per channel, because of ATTiny85 RAM restrictions. It only has 512 bytes of RAM and 64 LEDs use 64 * 3 = 192 bytes of RAM. The rest is required for the USB and other BlinkStick functionality.

Seems to be an issue with pywinusb package used by BlinkStick Python module. Does not look as it is going to be a quick fix.

Do you have a particular reason why you need to get data from the device? Normally I would keep an array buffer in software and use that to send to the device, but query the array to get the current color. BlinkStickPro class was specifically designed for this. You can find an example on how to use it here:

The idea is to use self.set_color and self.get_color methods to access and change the color values. Then when you are ready, you can send the data to the device with self.send_data_all().

You can find more details about the class here:

http://arvydas.github.io/blinkstick-python/blinkstick.blinkstick.BlinkStickPro-class.html

Yeah, I got it working with the set_led_data function; I just wanted to see the data format in the array but I figured it out myself so it’s fine. Also, thanks for telling me about the BlinkstickPro class, didn’t see that before.

It’s GRB in case anybody needs it, because that’s how LEDs require the data to be sent. A bit strange, but I think it related to how the actual R, G and B LED components are connected to the internal chip inside the WS2812. Didn’t see any point in overcomplicating the firmware with changing the API to accept RGB arrays :wink: