Python methods for BlinkStickPro/Square

Hi

Sorry for newbie questions, but I’m new to python and blinkstick - I’m using Blinkstick Square on Windows 7 / python 2.79 and can’t call any of BlinkStickPro class methods, like these were not imported at all, returning ‘no attribute’ errors.

I would also like to be able to control all LEDs on BlinkStickSquare at the same time, not individually (having the enclousure makes it larger pixel) - like set range of indexes 0-7 for channel of choice instead of having 8 lines of code. Maybe there is another way to achieve this? Will it also work for blink/pulse/morph methods?

Thanks,
Artur

Not sure why BlinkStickPro class does not work for you. Could you please post the code here?

If you want to light up all LEDs at once, you don’t need to use the BlinkStickPro class. Just find the first blinkstick and set mode to 3 via set_mode(3) command. You only need to do this once as BlinkStick remembers the mode even when you unplug it.

Now every time you send basic color without any index or channel with Python using set_color method, all LEDs will light up at the same time. All blink, pulse and morph features will work with all LEDs at the same time. For example:

from blinkstick import blinkstick

led = blinkstick.find_first()

led.set_mode(3) # you can omit this command after you run it once

led.set_color(name="red") # all LEDs should light up red

Thanks for your reply. Now it makes more sense to set mode to 3, didn’t even know there was more than 0,1,2 modes https://www.blinkstick.com/help/tutorials/blinkstick-pro-modes

When I’m trying to run the code from your post I get the following:

C:\Python27\Scripts\bs>set3.py

Traceback (most recent call last):
File “C:\Python27\Scripts\bs\set3.py”, line 5, in
led.set_mode(3) # you can omit this command after you run it once
File “C:\Python27\lib\site-packages\blinkstick\blinkstick.py”, line 493, in set_mode
self.device.ctrl_transfer(0x20, 0x9, 0x0004, 0, control_string)
AttributeError: ‘HidDevice’ object has no attribute ‘ctrl_transfer’

C:\Python27\Scripts\bs>

Am I missing something?

I can set colors just fine and blinkstick lights up…

EDIT: I think I found the answer: Control NeoMatrix with BlinkStickPro and Python

Yes, that’s the problem. I’ll push a new version of BlinkStick Python package in a bit which has this problem sorted out and includes some other minor fixes. Seems to be stable enough for a new version release.

All done. You can now run the following command to upgrade to 1.1.7:

pip install --upgrade blinkstick