webduino.module.Buzzer
The Buzzer Class.
Table of Contents
Constructor
webduino.module.Buzzer
-
board
-
pin
Parameters:
-
board
webduino.BoardThe board that the buzzer is attached to.
-
pin
IntegerThe pin that the buzzer is connected to.
Methods
addListener
-
type
-
listener
Add a listener for a certain type of event.
Parameters:
-
type
StringEvent type.
-
listener
FunctionEvent listener.
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.
on
-
type
-
listener
Alias for EventEmitter.addListener(type, listener)
Parameters:
-
type
StringEvent type.
-
listener
FunctionEvent listener.
once
-
type
-
listener
Add a one-time listener for a certain type of event.
Parameters:
-
type
StringEvent type.
-
listener
FunctionEvent listener.
pause
()
Pause the playback.
play
-
notes
-
tempos
Play specified note and tempo.
Parameters:
-
notes
ArrayArray of notes.
-
tempos
ArrayArray 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:
-
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.
stop
()
Stop the plaback.
tone
-
freq
-
duration
Set Buzzer tone.
Parameters:
-
freq
IntegerFrequency of tone.
-
duration
IntegerDuration of tone.
Properties
FREQUENCY
Number
const
static
Indicates the frequency of tone.
TONE_DELAY
Number
const
static
Indicates the delay of tone.