BO.io.BlinkM Class
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.
Constructor
BO.io.BlinkM
-
board -
address
Parameters:
-
boardIOBoardThe IOBoard instance
-
addressNumberThe i2c address of the BlinkM module
Item Index
Methods
Properties
Methods
addEventListener
-
type -
listener
Parameters:
-
typeStringThe event type
-
listenerFunctionThe function to be called when the event is fired
dispatchEvent
-
type -
optionalParams
Parameters:
-
typeEventThe Event object.
-
optionalParamsObjectOptional parameters passed as an object. return {boolean} True if dispatch is successful, false if not.
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:
-
colorNumberAn array containing the HSB values. color[0] = H, color[1] = S, color[2] = B
-
speedNumberThe 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:
-
colorRangeNumberAn array containing a range for each color value. colorRange[0] = range for Hue (0-255), colorRange[1] = range for Saturation, etc.
-
speedNumberThe 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:
-
colorRangeNumberAn array containing a range for each color value. colorRange[0] = range for Red (0-255), colorRange[1] = range for Green, etc.
-
speedNumberThe 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:
-
colorNumberAn array containing the RGB values. color[0] = R, color[1] = G, color[2] = B
-
speedNumberThe fade speed. Default value is 15.
goToRGBColorNow
-
}
Sets the BlinkM to the specified RGB color immediately.
Parameters:
-
}Numbercolor An array containing the RGB values. color[0] = R, color[1] = G, color[2] = B
handleI2C
()
private
hasEventListener
-
type
Parameters:
-
typeStringThe event type return {boolean} True is listener exists for this type, false if not.
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:
-
scriptIdNumberThe id of the light script (from 0 to 18).
-
theNumberOfRepeatsNumberThe number of times the script should repeat.
-
lineNumberNumberThe line number to begin the script from.
removeEventListener
-
type -
listener
Parameters:
-
typeStringThe event type
-
listenerFunctionThe function to be called when the event is fired
sendI2CRequest
-
command -
data
Send an i2c request command to the board
Parameters:
-
commandNumber -
dataNumber
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:
-
speedNumber
stopScript
()
Stop the currently playing predefined light script.
update
()
protected
To be implemented in subclass
Properties
address
Number
[read-only] The address of the i2c device.
