In processing what is the correct method to turn off the Blinkstick? and how to adjust the timing between colors?
Looks like there is no real support here.
maybe someone can explain to me what is the channels and the indexes?or where to find this info?
Hey! Which of the BlinkSticks do you have?
Blinkstick square. Shall I enter my code. I can only get one led to come on.
The square is composed of 8 LEDs, if you simply set the color it will turn on only the first LED.
To turn on different/multiple LEDs you can set the index of the one you want to turn on (from 0 to 7 respectively), to turn it off you can set both red, green and blue values to 0.
To turn them all on or off i cycle through all of them and set the color individually, unfortunately I don’t think there is a way to know the number of LEDs on a stick so I just counted them manually and made the loop cycle 8 iterations (there is a function to get the led count but it returns -1 for the square).
I don’t know if this is the most efficient way but it seems to work fine and by looking at the library I don’t see any other clear way to do it, bare in mind that I had my Blinksticks available since only a few days so I might be missing something very obvious.
I’m not really sure what the channel is used for either, I think is used by the Blinkstick Pro but I don’t have one so I can’t really test it
Best way to control BlinkStick Square is by using LED frames. Here is the example:
so this line //Sends to R channel
sends only to red channel.? sorry I am just new to this too.
BlinkStick Square is a derivative of BlinkStick Pro which has R=0, G=1 and B=2 channels to send digital data to LEDs. BlinkStick Square uses only R=0 channel for LED data transfers. For Square always use channel 0 to send data to the device.
If you want to know more about BlinkStick Pro and channels, you can find a bit more info in this tutorial:
what about the turn off? The device.turnOff() method doesnt seem to work.
For now, just send an LED frame with all 0, will have the turnOff feature fixed.
I added this code to turn it off; //switch off
byte data = new byte[leds * 3];
for (int i = 0; i < data.length; i++)
data[i] = (byte)(0);
In line 28 of above it says data[i] = (byte)random(128);
How do I actually set a color . data[i] = (byte)color(128);? or byte(128);
but it only sets a byte whereas a color needs 3 bytes like (128,0,0)? doesnt it? are they consecutive bytes? I am bit confused. I thought this would be easy.