upm  1.0.2
Sensor/Actuator repository for libmraa (v1.1.1)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions
Speaker Class Reference

API for the Speaker. More...

Detailed Description

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

speaker.jpg
// Instantiate a Speaker on digital pin D2
upm::Speaker* speaker = new upm::Speaker(2);
// Play all 7 of the lowest notes
speaker->playAll();
// Play a medium C-sharp
speaker->playSound('c', true, "med");

Public Member Functions

 Speaker (int pin)
 
 ~Speaker ()
 
void playAll ()
 
void playSound (char letter, bool sharp, std::string vocalWeight)
 

Constructor & Destructor Documentation

Speaker ( int  pin)

Speaker constructor

Parameters
pinDigital pin to use
~Speaker ( )

Speaker destructor

Member Function Documentation

void playAll ( )

Plays all alto notes (lowest notes)

Here is the call graph for this function:

void playSound ( char  letter,
bool  sharp,
std::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

Here is the caller graph for this function:


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