public class BlinkStick extends Object
Modifier and Type | Field and Description |
---|---|
static int |
PRODUCT_ID
BlinkStick product ID
|
static int |
VENDOR_ID
BlinkStick vendor ID
|
static String |
VERSION |
Constructor and Description |
---|
BlinkStick() |
Modifier and Type | Method and Description |
---|---|
static BlinkStick[] |
findAll()
Find all BlinkSticks connected to the computer
|
static BlinkStick |
findBySerial(String serial)
Find BlinkStick by serial number
|
static BlinkStick |
findFirst()
Find first BlinkStick connected to the computer
|
int |
getColor()
Get the current color of the device as int
|
String |
getColorString()
Get the current color of the device in #rrggbb format
|
String |
getInfoBlock1()
Get value of InfoBlock1
|
String |
getInfoBlock2()
Get value of InfoBlock2
|
String |
getManufacturer()
Get the manufacturer of the device
|
byte |
getMode()
Get the mode of BlinkStick Pro
|
String |
getProduct()
Get the product description of the device
|
String |
getSerial()
Get the serial number of the device
|
static void |
Initialize()
Load hidapi library based on the OS.
|
void |
setColor(byte r,
byte g,
byte b)
Set the color of the device with separate r, g and b byte values
|
void |
setColor(int value)
Set the color of the device with Processing color value
|
void |
setColor(int r,
int g,
int b)
Set the color of the device with separate r, g and b int values.
|
void |
setColor(String value)
Set the color of the device with string value
|
void |
setColors(byte[] colorData)
Send a packet of data to LEDs on channel 0 (R)
|
void |
setColors(byte channel,
byte[] colorData)
Send a packet of data to LEDs
|
void |
setColors(int channel,
byte[] colorData)
Send a packet of data to LEDs
|
void |
setIndexedColor(byte channel,
byte index,
byte r,
byte g,
byte b)
Set indexed color of the device with separate r, g and b byte values for channel and LED index
|
void |
setIndexedColor(int index,
int value)
Set the indexed color of BlinkStick Pro with Processing color value for channel 0
|
void |
setIndexedColor(int channel,
int index,
int value)
Set the indexed color of BlinkStick Pro with Processing color value
|
void |
setIndexedColor(int channel,
int index,
int r,
int g,
int b)
Set indexed color of the device with separate r, g and b byte values for channel and LED index
|
void |
setInfoBlock1(String value)
Set value for InfoBlock1
|
void |
setInfoBlock2(String value)
Set value for InfoBlock2
|
void |
setMode(byte mode)
Set the mode of BlinkStick Pro as byte
|
void |
setMode(int mode)
Set the mode of BlinkStick Pro as int
|
void |
setRandomColor()
Set random color
|
void |
turnOff()
Turn the device off
|
static String |
version()
return the version of the library.
|
public static final String VERSION
public static final int VENDOR_ID
public static final int PRODUCT_ID
public static String version()
public static void Initialize()
public static BlinkStick findFirst()
public static BlinkStick findBySerial(String serial)
serial
- The serial number to searchpublic static BlinkStick[] findAll()
public void setColor(int r, int g, int b)
r
- red int color value 0..255g
- gree int color value 0..255b
- blue int color value 0..255public void setColor(byte r, byte g, byte b)
r
- red byte color value 0..255g
- gree byte color value 0..255b
- blue byte color value 0..255public void setIndexedColor(int channel, int index, int r, int g, int b)
channel
- Channel (0 - R, 1 - G, 2 - B)index
- Index of the LEDr
- red int color value 0..255g
- gree int color value 0..255b
- blue int color value 0..255public void setIndexedColor(byte channel, byte index, byte r, byte g, byte b)
channel
- Channel (0 - R, 1 - G, 2 - B)index
- Index of the LEDr
- red byte color value 0..255g
- gree byte color value 0..255b
- blue byte color value 0..255public void setIndexedColor(int channel, int index, int value)
channel
- Channel (0 - R, 1 - G, 2 - B)index
- Index of the LEDvalue
- color as intpublic void setIndexedColor(int index, int value)
index
- Index of the LEDvalue
- color as intpublic void setColor(int value)
value
- color as intpublic void setColor(String value)
value
- this can either be a named color "red", "green", "blue" and etc.
or a hex color in #rrggbb formatpublic void setRandomColor()
public void turnOff()
public int getColor()
public String getColorString()
public String getInfoBlock1()
public String getInfoBlock2()
public void setInfoBlock1(String value)
value
- The value to be written to the info block 1public void setInfoBlock2(String value)
value
- The value to be written to the info block 2public String getManufacturer()
public String getProduct()
public String getSerial()
public void setColors(byte[] colorData)
colorData
- Report data must be a byte array in the following format: [g0, r0, b0, g1, r1, b1, g2, r2, b2 ...]public void setColors(int channel, byte[] colorData)
channel
- Channel (0 - R, 1 - G, 2 - B)colorData
- Report data must be a byte array in the following format: [g0, r0, b0, g1, r1, b1, g2, r2, b2 ...]public void setColors(byte channel, byte[] colorData)
channel
- Channel (0 - R, 1 - G, 2 - B)colorData
- Report data must be a byte array in the following format: [g0, r0, b0, g1, r1, b1, g2, r2, b2 ...]public void setMode(int mode)
mode
- 0 - Normal, 1 - Inverse, 2 - WS2812, 3 - WS2812 mirrorpublic void setMode(byte mode)
mode
- 0 - Normal, 1 - Inverse, 2 - WS2812, 3 - WS2812 mirrorpublic byte getMode()
Processing library BlinkStick by Arvydas Juskevicius. (C) 2013-2014