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:
-
board
IOBoardThe IOBoard instance
-
address
NumberThe i2c address of the BlinkM module
Item Index
Methods
Properties
Methods
addEventListener
-
type
-
listener
Parameters:
-
type
StringThe event type
-
listener
FunctionThe function to be called when the event is fired
dispatchEvent
-
type
-
optionalParams
Parameters:
-
type
EventThe Event object.
-
optionalParams
ObjectOptional 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:
-
color
NumberAn array containing the HSB values. color[0] = H, color[1] = S, color[2] = B
-
speed
NumberThe 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:
-
colorRange
NumberAn array containing a range for each color value. colorRange[0] = range for Hue (0-255), colorRange[1] = range for Saturation, etc.
-
speed
NumberThe 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:
-
colorRange
NumberAn array containing a range for each color value. colorRange[0] = range for Red (0-255), colorRange[1] = range for Green, etc.
-
speed
NumberThe 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:
-
color
NumberAn array containing the RGB values. color[0] = R, color[1] = G, color[2] = B
-
speed
NumberThe 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:
-
type
StringThe 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:
-
scriptId
NumberThe id of the light script (from 0 to 18).
-
theNumberOfRepeats
NumberThe number of times the script should repeat.
-
lineNumber
NumberThe line number to begin the script from.
removeEventListener
-
type
-
listener
Parameters:
-
type
StringThe event type
-
listener
FunctionThe function to be called when the event is fired
sendI2CRequest
-
command
-
data
Send an i2c request command to the board
Parameters:
-
command
Number -
data
Number
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:
-
speed
Number
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.