webduino.module.Led
The Led class.
Table of Contents
Constructor
webduino.module.Led
-
board -
pin -
driveMode
Parameters:
-
boardwebduino.BoardThe board the LED is attached to.
-
pinwebduino.PinThe pin the LED is connected to.
-
[driveMode]Number optionalDrive mode the LED is operating at, either Led.SOURCE_DRIVE or Led.SYNC_DRIVE.
Methods
addListener
-
type -
listener
Add a listener for a certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
blink
-
interval=1000 -
callback
Blink the LED.
Parameters:
-
[interval=1000]Number optionalLed blinking interval.
-
[callback]Function optionalLed state changed callback.
emit
-
type -
object,...
Emit an event of certain type.
Parameters:
-
typeStringEvent type.
-
[object,...]Object optionalEvent object(s).
listeners
-
type
Return the listener list bound to certain type of event.
Parameters:
-
typeStringEvnet type.
off
-
callback
Dim the LED.
Parameters:
-
[callback]Function optionalLED state changed callback.
on
-
callback
Light up the LED.
Parameters:
-
[callback]Function optionalLED state changed callback.
once
-
type -
listener
Add a one-time listener for a certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
removeAllListeners
-
type
Remove all listeners of certain type.
Parameters:
-
typeStringEvent type.
removeListener
-
type -
listener
Remove a listener for certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
setMaxListeners
-
n
Set maximum number of listeners that is allow to bind on an emitter.
Parameters:
-
nNumberNumber of listeners.
toggle
-
callback
Toggle LED state between on/off.
Parameters:
-
[callback]Function optionalState changed callback.
Properties
SOURCE_DRIVE
Number
const
static
Indicates the source LED drive mode.
SYNC_DRIVE
Number
const
static
Indicates the synchronous LED drive mode.