webduino.module.Buzzer
The Buzzer Class.
Table of Contents
Constructor
webduino.module.Buzzer
-
board -
pin
Parameters:
-
boardwebduino.BoardThe board that the buzzer is attached to.
-
pinIntegerThe pin that the buzzer is connected to.
Methods
addListener
-
type -
listener
Add a listener for a certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
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.
on
-
type -
listener
Alias for EventEmitter.addListener(type, listener)
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
once
-
type -
listener
Add a one-time listener for a certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
pause
()
Pause the playback.
play
-
notes -
tempos
Play specified note and tempo.
Parameters:
-
notesArrayArray of notes.
-
temposArrayArray of tempos.
Example:
buzzer.play(["C6","D6","E6","F6","G6","A6","B6"], ["8","8","8","8","8","8","8"]);
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.
stop
()
Stop the plaback.
tone
-
freq -
duration
Set Buzzer tone.
Parameters:
-
freqIntegerFrequency of tone.
-
durationIntegerDuration of tone.
Properties
FREQUENCY
Number
const
static
Indicates the frequency of tone.
TONE_DELAY
Number
const
static
Indicates the delay of tone.