All Classes Namespaces Functions Variables Properties Events
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
BlinkStickDotNet.BlinkStick Class Reference

BlinkStick class is designed to control regular BlinkStick devices.Code examples on how you can use this class are available wiki. More...

Inheritance diagram for BlinkStickDotNet.BlinkStick:

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...
 

Detailed Description

BlinkStick class is designed to control regular BlinkStick devices.

Code examples on how you can use this class are available wiki.

Constructor & Destructor Documentation

BlinkStickDotNet.BlinkStick.BlinkStick ( )

Initializes a new instance of the BlinkStick class.

Member Function Documentation

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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
rThe red component.
gThe green component.
bThe blue component.
repeatsHow many times to repeat (default 1)
delayDelay 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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
colorColor parameter as RgbColor class instance
repeatsHow many times to repeat (default 1)
delayDelay 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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
colorMust be in #rrggbb format or named color ("red", "green", "blue")
repeatsHow many times to repeat (default 1)
delayDelay 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.

Parameters
rThe red component.
gThe green component.
bThe blue component.
repeatsHow many times to repeat (default 1)
delayDelay delay between on/off sequences (default 500)
void BlinkStickDotNet.BlinkStick.Blink ( RgbColor  color,
int  repeats = 1,
int  delay = 500 
)

Blink the LED.

Parameters
colorMust be in #rrggbb format or named color ("red", "green", "blue")
repeatsHow many times to repeat (default 1)
delayDelay delay between on/off sequences (default 500)
void BlinkStickDotNet.BlinkStick.Blink ( string  color,
int  repeats = 1,
int  delay = 500 
)

Blink the LED.

Parameters
colorMust be in #rrggbb format or named color ("red", "green", "blue")
repeatsHow many times to repeat (default 1)
delayDelay 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 BlinkStick [] BlinkStickDotNet.BlinkStick.FindAll ( )
static

Find all BlinkStick devices.

Returns
An array of BlinkStick devices
static BlinkStick BlinkStickDotNet.BlinkStick.FindBySerial ( String  serial)
static

Finds BlinkStick by serial number.

Returns
BlinkStick device if found, otherwise null if no devices found
Parameters
serialSerial number to search for
static BlinkStick BlinkStickDotNet.BlinkStick.FindFirst ( )
static

Find first BlinkStick.

Returns
BlinkStick device if found, otherwise null if no devices found
Boolean BlinkStickDotNet.BlinkStick.GetColor ( out byte  r,
out byte  g,
out byte  b 
)

Gets the color of the led.

Returns
true, if led color was received, false otherwise.
Parameters
rThe red component.
gThe green component.
bThe blue component.
Boolean BlinkStickDotNet.BlinkStick.GetColor ( byte  index,
out byte  r,
out byte  g,
out byte  b 
)

Gets the color of the led.

Returns
true, if led color was received, false otherwise.
Parameters
rThe red component.
gThe green component.
bThe blue component.
Boolean BlinkStickDotNet.BlinkStick.GetColors ( out byte[]  colorData)

Gets led data.

Returns
true, if led data was received, false otherwise.
Parameters
dataLED 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.

Returns
true, if info block was received, false otherwise.
Parameters
idIdentifier.
dataData.
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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
rThe red component.
gThe green component.
bThe blue component.
durationHow long should the morph last
stepsHow 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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
colorColor parameter as RgbColor class instance
durationHow long should the morph last
stepsHow 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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
colorMust be in #rrggbb format or named color ("red", "green", "blue")
durationHow long should the morph last
stepsHow 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.

Parameters
rThe red component.
gThe green component.
bThe blue component.
durationHow long should the morph last
stepsHow many steps for color changes
void BlinkStickDotNet.BlinkStick.Morph ( RgbColor  color,
int  duration = 1000,
int  steps = 50 
)

Morph from current color to new color.

Parameters
colorMust be in #rrggbb format or named color ("red", "green", "blue")
durationHow long should the morph last
stepsHow many steps for color changes
void BlinkStickDotNet.BlinkStick.Morph ( string  color,
int  duration = 1000,
int  steps = 50 
)

Morph from current color to new color.

Parameters
colorMust be in #rrggbb format or named color ("red", "green", "blue")
durationHow long should the morph last
stepsHow 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.

Returns
True if a Blinkstick device is connected, False otherwise.
bool BlinkStickDotNet.BlinkStick.OpenDevice ( HidDevice  adevice)

Opens the device.

Returns
true, if device was opened, false otherwise.
Parameters
adevicePass 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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
rThe red component.
gThe green component.
bThe blue component.
durationHow long should the morph last
stepsHow 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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
colorColor parameter as RgbColor class instance
durationHow long should the morph last
stepsHow 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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
colorMust be in #rrggbb format or named color ("red", "green", "blue")
durationHow long should the morph last
stepsHow 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.

Parameters
rThe red component.
gThe green component.
bThe blue component.
durationHow long should the morph last
stepsHow many steps for color changes
void BlinkStickDotNet.BlinkStick.Pulse ( RgbColor  color,
int  repeats = 1,
int  duration = 1000,
int  steps = 50 
)

Pulse specified color.

Parameters
colorMust be in #rrggbb format or named color ("red", "green", "blue")
durationHow long should the morph last
stepsHow many steps for color changes
void BlinkStickDotNet.BlinkStick.Pulse ( string  color,
int  repeats = 1,
int  duration = 1000,
int  steps = 50 
)

Pulse specified color.

Parameters
colorMust be in #rrggbb format or named color ("red", "green", "blue")
durationHow long should the morph last
stepsHow many steps for color changes
void BlinkStickDotNet.BlinkStick.SetColor ( String  color)

Sets the color of the led.

Parameters
colorMust be in #rrggbb format
void BlinkStickDotNet.BlinkStick.SetColor ( RgbColor  color)

Sets the color of the led.

Parameters
colorColor as RgbColor class.
void BlinkStickDotNet.BlinkStick.SetColor ( byte  r,
byte  g,
byte  b 
)

Sets the color of the led.

Parameters
rThe red component.
gThe green component.
bThe blue component.
void BlinkStickDotNet.BlinkStick.SetColor ( byte  channel,
byte  index,
byte  r,
byte  g,
byte  b 
)

Sets the color of the led.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
rThe red component.
gThe green component.
bThe blue component.
void BlinkStickDotNet.BlinkStick.SetColor ( byte  channel,
byte  index,
string  color 
)

Sets the color of the led.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
colorMust 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.

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
colorColor parameter as RgbColor class instance
void BlinkStickDotNet.BlinkStick.SetColors ( byte  channel,
byte[]  colorData 
)

Send a packet of data to LEDs

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
reportDataReport 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.

Parameters
mode0 - Normal, 1 - Inverse, 2 - WS2812
void BlinkStickDotNet.BlinkStick.TurnOff ( )

Turn BlinkStick off.

Property Documentation

Boolean BlinkStickDotNet.BlinkStick.Connected
get

Gets a value indicating whether this BlinkStickDotNet.BlinkStick is connected.

true if connected; otherwise, false.

String BlinkStickDotNet.BlinkStick.InfoBlock1
getset

Gets or sets the name of the device (InfoBlock1).

String value of InfoBlock1

String BlinkStickDotNet.BlinkStick.InfoBlock2
getset

Gets or sets the data of the device (InfoBlock2).

String value of InfoBlock2

String BlinkStickDotNet.BlinkStick.ManufacturerName
get

Gets the name of the manufacturer.

Returns the name of the manufacturer.

String BlinkStickDotNet.BlinkStick.ProductName
get

Gets the product name of the device.

Returns the name of the product.

String BlinkStickDotNet.BlinkStick.Serial
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.

int BlinkStickDotNet.BlinkStick.VersionMajor
get

Gets the major version number from serial number.

Returns the major version number.

int BlinkStickDotNet.BlinkStick.VersionMinor
get

Gets the minor version number from serial number.

Returns the version minor.


The documentation for this class was generated from the following file: