upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the Grove Speaker. More...

Detailed Description

UPM module for the Grove Speaker. This sensor can generate different tones and sounds depending on the frequency of the input signal.

grovespeaker.jpg
// Instantiate a Grove Speaker on digital pin D2
// Play all 7 of the lowest notes
speaker.playAll();
// Play a medium C-sharp
speaker.playSound('c', true, "med");

Public Member Functions

synchronized void delete ()
 
 GroveSpeaker (int pin)
 
void playAll ()
 
void playSound (char letter, boolean sharp, String vocalWeight)
 

Constructor & Destructor Documentation

GroveSpeaker ( int  pin)

Grove Speaker constructor

Parameters
pinDigital pin to use

Member Function Documentation

void playAll ( )

Plays all alto notes (lowest notes)

void playSound ( char  letter,
boolean  sharp,
String  vocalWeight 
)

Plays a sound and a note whether it's sharp or not

Parameters
letterCharacter name of the note ('a', 'b', 'c', 'd', 'e', 'f', or 'g')
sharpIf true, plays a sharp version of the note; otherwise, does not play the note
vocalWeightString to determine whether to play a low ("low"), a medium ("med"), or a high ("high") note

The documentation for this class was generated from the following file: