SPEAKER i [TO] frequency [[TIME] seconds]

Command:

SPEAKER i [TO] frequency [[TIME] seconds]

 

Command Syntax:

SET SPEAKER i [TO] frequency [[TIME] seconds]

Range:

 

Describe:

Same as SOUND above, except sound is played on an external speaker attached to a digital output pin, available on any IN/OUT port, or the breadboard connector port.

Note: On-board SOUND and external SPEAKER cannot be used concurrently.

Result:

Play tone with frequency given, optional duration in milliseconds, default = 1 second.

Type or
Addressable Component:

Control

 

TEMPO keyword for SOUND/SPEAKER

Quick way to add repeated beeps
Equivalent to “blink” for SOUND
New optional keyword – TEMPO

SET SOUND 440 TEMPO 2 TIME 2

2 beeps per second for 2 seconds: total 4 beeps
The value for TEMPO can range from 0 to 10

Code
Sample:

SET SOUND 440 TEMPO 2 TIME 5

SET SPEAKER 1 880 TEMPO 3 TIME 4

 

SET SOUND 400 TIME 5 TEMPO 0

is equivalent to

SET SOUND 400 TIME 5

Both commands will play the tone for 5 seconds without any breaks.