On-Board Speaker Data Sheet

Speaker (at back of Hub) is addressable as "SOUND" in Hub command strings.

Title

On-Board Speaker

TI Item Name

Built into the Hub

Description

Built-in speaker located at the back of the Hub. It converts electrical current into sound you can hear.

Category

Sound Output

Hub Connection

on-board Hub

Assembly Instructions

Not Applicable

Precautions

Not Applicable

Specifications

Not Applicable

 

HUB Commands

 

Sketch Object

SOUND

Command Syntax

Send("SET SOUND …")

   Frequency in Hz or Note as C1, CS1, D2, ...

   [TIME duration in seconds]

Code
Sample:

Desired Action

Code Sample

Play tone at 261.23 Hz

Send("SET SOUND 261.23")

Evaluate the expression 2^8 (= 256) and play that tone

Send("SET SOUND eval(2^8)")

Evaluate the expression 2^8 ( = 256) and play that tone for .25 seconds

Send("SET SOUND eval(2^8) TIME .25")

Evaluate the expression 2^9 (= 512) and play that tone for 0.25 seconds (result of evaluating 1/4)

Send("SET SOUND eval(2^9) TIME eval(1/4)")

Turn speaker off

Send("SET SOUND OFF")