BlinkStick class is designed to control regular BlinkStick devices.Code examples on how you can use this class are available wiki. More...
Public Member Functions | |
BlinkStick () | |
Initializes a new instance of the BlinkStick class. More... | |
void | Dispose () |
Disposes of the device and closes the connection. More... | |
bool | OpenDevice () |
Attempts to connect to a BlinkStick device. More... | |
bool | OpenDevice (HidDevice adevice) |
Opens the device. More... | |
void | CloseDevice () |
Closes the connection to the device. More... | |
Boolean | GetInfoBlock (byte id, out byte[] data) |
Gets the info block. More... | |
void | SetColor (String color) |
Sets the color of the led. More... | |
void | SetColor (RgbColor color) |
Sets the color of the led. More... | |
void | SetColor (byte r, byte g, byte b) |
Sets the color of the led. More... | |
Boolean | GetColor (out byte r, out byte g, out byte b) |
Gets the color of the led. More... | |
void | TurnOff () |
Turn BlinkStick off. More... | |
void | SetColor (byte channel, byte index, byte r, byte g, byte b) |
Sets the color of the led. More... | |
void | SetColor (byte channel, byte index, string color) |
Sets the color of the led. More... | |
void | SetColor (byte channel, byte index, RgbColor color) |
Sets the color of the led. More... | |
void | SetColors (byte channel, byte[] colorData) |
Send a packet of data to LEDs More... | |
Boolean | GetColors (out byte[] colorData) |
Gets led data. More... | |
Boolean | GetColor (byte index, out byte r, out byte g, out byte b) |
Gets the color of the led. More... | |
void | SetMode (byte mode) |
Sets the mode for BlinkStick Pro. More... | |
void | Blink (byte channel, byte index, byte r, byte g, byte b, int repeats=1, int delay=500) |
Blink the LED on BlinkStick Pro. More... | |
void | Blink (byte channel, byte index, RgbColor color, int repeats=1, int delay=500) |
Blink the LED on BlinkStick Pro. More... | |
void | Blink (byte channel, byte index, string color, int repeats=1, int delay=500) |
Blink the LED on BlinkStick Pro. More... | |
void | Blink (byte r, byte g, byte b, int repeats=1, int delay=500) |
Blink the LED. More... | |
void | Blink (RgbColor color, int repeats=1, int delay=500) |
Blink the LED. More... | |
void | Blink (string color, int repeats=1, int delay=500) |
Blink the LED. More... | |
void | Morph (byte channel, byte index, byte r, byte g, byte b, int duration=1000, int steps=50) |
Morph from current color to new color on BlinkStick Pro. More... | |
void | Morph (byte channel, byte index, RgbColor color, int duration=1000, int steps=50) |
Morph from current color to new color on BlinkStick Pro. More... | |
void | Morph (byte channel, byte index, string color, int duration=1000, int steps=50) |
Morph from current color to new color on BlinkStick Pro. More... | |
void | Morph (byte r, byte g, byte b, int duration=1000, int steps=50) |
Morph from current color to new color. More... | |
void | Morph (RgbColor color, int duration=1000, int steps=50) |
Morph from current color to new color. More... | |
void | Morph (string color, int duration=1000, int steps=50) |
Morph from current color to new color. More... | |
void | Pulse (byte channel, byte index, byte r, byte g, byte b, int repeats=1, int duration=1000, int steps=50) |
Pulse specified color on BlinkStick Pro. More... | |
void | Pulse (byte channel, byte index, RgbColor color, int repeats=1, int duration=1000, int steps=50) |
Pulse specified color on BlinkStick Pro. More... | |
void | Pulse (byte channel, byte index, string color, int repeats=1, int duration=1000, int steps=50) |
Pulse specified color on BlinkStick Pro. More... | |
void | Pulse (byte r, byte g, byte b, int repeats=1, int duration=1000, int steps=50) |
Pulse specified color. More... | |
void | Pulse (RgbColor color, int repeats=1, int duration=1000, int steps=50) |
Pulse specified color. More... | |
void | Pulse (string color, int repeats=1, int duration=1000, int steps=50) |
Pulse specified color. More... | |
Static Public Member Functions | |
static BlinkStick[] | FindAll () |
Find all BlinkStick devices. More... | |
static BlinkStick | FindFirst () |
Find first BlinkStick. More... | |
static BlinkStick | FindBySerial (String serial) |
Finds BlinkStick by serial number. More... | |
Protected Member Functions | |
void | SetInfoBlock (byte id, byte[] data) |
Protected Attributes | |
const int | VendorId = 0x20A0 |
const int | ProductId = 0x41E5 |
bool | connectedToDriver = false |
Properties | |
Boolean | Connected [get] |
Gets a value indicating whether this BlinkStickDotNet.BlinkStick is connected. More... | |
String | Serial [get] |
Returns the serial number of BlinkStick. More... | |
int | VersionMajor [get] |
Gets the major version number from serial number. More... | |
int | VersionMinor [get] |
Gets the minor version number from serial number. More... | |
String | ManufacturerName [get] |
Gets the name of the manufacturer. More... | |
String | ProductName [get] |
Gets the product name of the device. More... | |
String | InfoBlock1 [get, set] |
Gets or sets the name of the device (InfoBlock1). More... | |
String | InfoBlock2 [get, set] |
Gets or sets the data of the device (InfoBlock2). More... | |
BlinkStick class is designed to control regular BlinkStick devices.
Code examples on how you can use this class are available wiki.
BlinkStickDotNet.BlinkStick.BlinkStick | ( | ) |
Initializes a new instance of the BlinkStick class.
void BlinkStickDotNet.BlinkStick.Blink | ( | byte | channel, |
byte | index, | ||
byte | r, | ||
byte | g, | ||
byte | b, | ||
int | repeats = 1 , |
||
int | delay = 500 |
||
) |
Blink the LED on BlinkStick Pro.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
r | The red component. |
g | The green component. |
b | The blue component. |
repeats | How many times to repeat (default 1) |
delay | Delay delay between on/off sequences (default 500) |
void BlinkStickDotNet.BlinkStick.Blink | ( | byte | channel, |
byte | index, | ||
RgbColor | color, | ||
int | repeats = 1 , |
||
int | delay = 500 |
||
) |
Blink the LED on BlinkStick Pro.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
color | Color parameter as RgbColor class instance |
repeats | How many times to repeat (default 1) |
delay | Delay delay between on/off sequences (default 500) |
void BlinkStickDotNet.BlinkStick.Blink | ( | byte | channel, |
byte | index, | ||
string | color, | ||
int | repeats = 1 , |
||
int | delay = 500 |
||
) |
Blink the LED on BlinkStick Pro.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
repeats | How many times to repeat (default 1) |
delay | Delay delay between on/off sequences (default 500) |
void BlinkStickDotNet.BlinkStick.Blink | ( | byte | r, |
byte | g, | ||
byte | b, | ||
int | repeats = 1 , |
||
int | delay = 500 |
||
) |
Blink the LED.
r | The red component. |
g | The green component. |
b | The blue component. |
repeats | How many times to repeat (default 1) |
delay | Delay delay between on/off sequences (default 500) |
void BlinkStickDotNet.BlinkStick.Blink | ( | RgbColor | color, |
int | repeats = 1 , |
||
int | delay = 500 |
||
) |
Blink the LED.
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
repeats | How many times to repeat (default 1) |
delay | Delay delay between on/off sequences (default 500) |
void BlinkStickDotNet.BlinkStick.Blink | ( | string | color, |
int | repeats = 1 , |
||
int | delay = 500 |
||
) |
Blink the LED.
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
repeats | How many times to repeat (default 1) |
delay | Delay delay between on/off sequences (default 500) |
void BlinkStickDotNet.BlinkStick.CloseDevice | ( | ) |
Closes the connection to the device.
void BlinkStickDotNet.BlinkStick.Dispose | ( | ) |
Disposes of the device and closes the connection.
|
static |
Find all BlinkStick devices.
|
static |
Finds BlinkStick by serial number.
serial | Serial number to search for |
|
static |
Find first BlinkStick.
Boolean BlinkStickDotNet.BlinkStick.GetColor | ( | out byte | r, |
out byte | g, | ||
out byte | b | ||
) |
Gets the color of the led.
true
, if led color was received, false
otherwise.r | The red component. |
g | The green component. |
b | The blue component. |
Boolean BlinkStickDotNet.BlinkStick.GetColor | ( | byte | index, |
out byte | r, | ||
out byte | g, | ||
out byte | b | ||
) |
Gets the color of the led.
true
, if led color was received, false
otherwise.r | The red component. |
g | The green component. |
b | The blue component. |
Boolean BlinkStickDotNet.BlinkStick.GetColors | ( | out byte[] | colorData | ) |
Gets led data.
true
, if led data was received, false
otherwise.data | LED data as an array of colors [g0, r0, b0, g1, r1, b1 ...] |
Boolean BlinkStickDotNet.BlinkStick.GetInfoBlock | ( | byte | id, |
out byte[] | data | ||
) |
Gets the info block.
true
, if info block was received, false
otherwise.id | Identifier. |
data | Data. |
void BlinkStickDotNet.BlinkStick.Morph | ( | byte | channel, |
byte | index, | ||
byte | r, | ||
byte | g, | ||
byte | b, | ||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Morph from current color to new color on BlinkStick Pro.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
r | The red component. |
g | The green component. |
b | The blue component. |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Morph | ( | byte | channel, |
byte | index, | ||
RgbColor | color, | ||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Morph from current color to new color on BlinkStick Pro.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
color | Color parameter as RgbColor class instance |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Morph | ( | byte | channel, |
byte | index, | ||
string | color, | ||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Morph from current color to new color on BlinkStick Pro.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Morph | ( | byte | r, |
byte | g, | ||
byte | b, | ||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Morph from current color to new color.
r | The red component. |
g | The green component. |
b | The blue component. |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Morph | ( | RgbColor | color, |
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Morph from current color to new color.
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Morph | ( | string | color, |
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Morph from current color to new color.
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
duration | How long should the morph last |
steps | How many steps for color changes |
bool BlinkStickDotNet.BlinkStick.OpenDevice | ( | ) |
Attempts to connect to a BlinkStick device.
After a successful connection, a DeviceAttached event will normally be sent.
bool BlinkStickDotNet.BlinkStick.OpenDevice | ( | HidDevice | adevice | ) |
Opens the device.
true
, if device was opened, false
otherwise.adevice | Pass the parameter of HidDevice to open it directly |
void BlinkStickDotNet.BlinkStick.Pulse | ( | byte | channel, |
byte | index, | ||
byte | r, | ||
byte | g, | ||
byte | b, | ||
int | repeats = 1 , |
||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Pulse specified color on BlinkStick Pro.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
r | The red component. |
g | The green component. |
b | The blue component. |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Pulse | ( | byte | channel, |
byte | index, | ||
RgbColor | color, | ||
int | repeats = 1 , |
||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Pulse specified color on BlinkStick Pro.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
color | Color parameter as RgbColor class instance |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Pulse | ( | byte | channel, |
byte | index, | ||
string | color, | ||
int | repeats = 1 , |
||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Pulse specified color on BlinkStick Pro.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Pulse | ( | byte | r, |
byte | g, | ||
byte | b, | ||
int | repeats = 1 , |
||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Pulse specified color.
r | The red component. |
g | The green component. |
b | The blue component. |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Pulse | ( | RgbColor | color, |
int | repeats = 1 , |
||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Pulse specified color.
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.Pulse | ( | string | color, |
int | repeats = 1 , |
||
int | duration = 1000 , |
||
int | steps = 50 |
||
) |
Pulse specified color.
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
duration | How long should the morph last |
steps | How many steps for color changes |
void BlinkStickDotNet.BlinkStick.SetColor | ( | String | color | ) |
Sets the color of the led.
color | Must be in #rrggbb format |
void BlinkStickDotNet.BlinkStick.SetColor | ( | RgbColor | color | ) |
Sets the color of the led.
color | Color as RgbColor class. |
void BlinkStickDotNet.BlinkStick.SetColor | ( | byte | r, |
byte | g, | ||
byte | b | ||
) |
Sets the color of the led.
r | The red component. |
g | The green component. |
b | The blue component. |
void BlinkStickDotNet.BlinkStick.SetColor | ( | byte | channel, |
byte | index, | ||
byte | r, | ||
byte | g, | ||
byte | b | ||
) |
Sets the color of the led.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
r | The red component. |
g | The green component. |
b | The blue component. |
void BlinkStickDotNet.BlinkStick.SetColor | ( | byte | channel, |
byte | index, | ||
string | color | ||
) |
Sets the color of the led.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
color | Must be in #rrggbb format or named color ("red", "green", "blue") |
void BlinkStickDotNet.BlinkStick.SetColor | ( | byte | channel, |
byte | index, | ||
RgbColor | color | ||
) |
Sets the color of the led.
channel | Channel (0 - R, 1 - G, 2 - B) |
index | Index of the LED |
color | Color parameter as RgbColor class instance |
void BlinkStickDotNet.BlinkStick.SetColors | ( | byte | channel, |
byte[] | colorData | ||
) |
Send a packet of data to LEDs
channel | Channel (0 - R, 1 - G, 2 - B) |
reportData | Report data must be a byte array in the following format: [g0, r0, b0, g1, r1, b1, g2, r2, b2 ...] |
void BlinkStickDotNet.BlinkStick.SetMode | ( | byte | mode | ) |
Sets the mode for BlinkStick Pro.
mode | 0 - Normal, 1 - Inverse, 2 - WS2812 |
void BlinkStickDotNet.BlinkStick.TurnOff | ( | ) |
Turn BlinkStick off.
|
get |
Gets a value indicating whether this BlinkStickDotNet.BlinkStick is connected.
true
if connected; otherwise, false
.
|
getset |
Gets or sets the name of the device (InfoBlock1).
String value of InfoBlock1
|
getset |
Gets or sets the data of the device (InfoBlock2).
String value of InfoBlock2
|
get |
Gets the name of the manufacturer.
Returns the name of the manufacturer.
|
get |
Gets the product name of the device.
Returns the name of the product.
|
get |
Returns the serial number of BlinkStick.
BSnnnnnn-1.0 || | | |- Software minor version || | |--- Software major version || |-------- Denotes sequential number ||----------- Denotes BlinkStick device
Software version defines the capabilities of the device
Returns the serial.
|
get |
Gets the major version number from serial number.
Returns the major version number.
|
get |
Gets the minor version number from serial number.
Returns the version minor.