Class BO.io.BlinkM
Extends
BO.I2CBase.
Creates an interface to a BlinkM RGB Led module. This
object allows you to change the color of the led, fade between
colors and run preprogrammed light scripts.
See Breakout/examples/actuators/blinkM.html for an example application.
Defined in: BlinkM.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
BO.io.BlinkM(board, address)
Creates and BlinkM object
|
- Fields borrowed from class BO.I2CBase:
- address, board
| Method Attributes | Method Name and Description |
|---|---|
|
fadeToHSBColor(color, speed)
Fades to the specified HSB color in the specified time duration.
|
|
|
fadeToRandomHSBColor(colorRange, speed)
Fade to a random HSB color.
|
|
|
fadeToRandomRGBColor(colorRange, speed)
Fade to a random RGB color.
|
|
|
fadeToRGBColor(color, speed)
Fades to the specified RGB color in the specified time duration.
|
|
|
goToRGBColorNow(color)
Sets the BlinkM to the specified RGB color immediately
|
|
|
playLightScript(scriptId, theNumberOfRepeats, lineNumber)
Play a predefined light script.
|
|
|
setFadeSpeed(speed)
Set the rate at which color fading happens.
|
|
|
Stop the currently playing predefined light script.
|
- Methods borrowed from class BO.I2CBase:
- addEventListener, dispatchEvent, handleI2C, hasEventListener, removeEventListener, sendI2CRequest, update
Class Detail
BO.io.BlinkM(board, address)
Creates and BlinkM object
- Parameters:
- {IOBoard} board
- The IOBoard instance
- {Number} address
- The i2c address of the BlinkM module
Method Detail
fadeToHSBColor(color, speed)
Fades to the specified HSB color in the specified time duration.
The fade speed range is from 1 to 255, where 1 is the slowest time and 255 is the fastest.
- Parameters:
- {Number[]} color
- An array containing the HSB values. color[0] = H, color[1] = S, color[2] = B
- {Number} speed
- The fade speed. Default value is 15.
fadeToRandomHSBColor(colorRange, speed)
Fade to a random HSB color.
The fade speed range is from 1 to 255, where 1 is the slowest time and 255 is the fastest.
- Parameters:
- {Number[]} colorRange
- An array containing a range for each color value. colorRange[0] = range for Hue (0-255), colorRange[1] = range for Saturation, etc.
- {Number} speed
- The fade speed. Default value is 15.
fadeToRandomRGBColor(colorRange, speed)
Fade to a random RGB color.
The fade speed range is from 1 to 255, where 1 is the slowest time and 255 is the fastest.
- Parameters:
- {Number[]} colorRange
- An array containing a range for each color value. colorRange[0] = range for Red (0-255), colorRange[1] = range for Green, etc.
- {Number} speed
- The fade speed. Default value is 15.
fadeToRGBColor(color, speed)
Fades to the specified RGB color in the specified time duration.
The fade speed range is from 1 to 255, where 1 is the slowest time and 255 is the fastest.
- Parameters:
- {Number[]} color
- An array containing the RGB values. color[0] = R, color[1] = G, color[2] = B
- {Number} speed
- The fade speed. Default value is 15.
goToRGBColorNow(color)
Sets the BlinkM to the specified RGB color immediately
- Parameters:
- {Number{}} color
- An array containing the RGB values. color[0] = R, color[1] = G, color[2] = B
playLightScript(scriptId, theNumberOfRepeats, lineNumber)
Play a predefined light script. See the BlinkM datasheet page 20 for a list and
description of the predefined scripts.
- Parameters:
- {Number} scriptId
- The id of the light script (from 0 to 18).
- {Number} theNumberOfRepeats
- The number of times the script should repeat.
- {Number} lineNumber
- The line number to begin the script from.
setFadeSpeed(speed)
Set the rate at which color fading happens. The range is from 1 to 255, where 1 is the
slowest and 255 is the fastest (immediate).
- Parameters:
- {Number} speed
stopScript()
Stop the currently playing predefined light script.
