webduino.module.Led
The Led class.
Table of Contents
Constructor
webduino.module.Led
-
board
-
pin
-
driveMode
Parameters:
-
board
webduino.BoardThe board the LED is attached to.
-
pin
webduino.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:
-
type
StringEvent type.
-
listener
FunctionEvent 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:
-
type
StringEvent type.
-
[object,...]
Object optionalEvent object(s).
listeners
-
type
Return the listener list bound to certain type of event.
Parameters:
-
type
StringEvnet 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:
-
type
StringEvent type.
-
listener
FunctionEvent listener.
removeAllListeners
-
type
Remove all listeners of certain type.
Parameters:
-
type
StringEvent type.
removeListener
-
type
-
listener
Remove a listener for certain type of event.
Parameters:
-
type
StringEvent type.
-
listener
FunctionEvent listener.
setMaxListeners
-
n
Set maximum number of listeners that is allow to bind on an emitter.
Parameters:
-
n
NumberNumber 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.