upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions
ISD1820 Class Reference

API support for the ISD1820-based Grove Voice Recorder. More...

Detailed Description

This class implements support for the Grove Voice Recorder. There are two digital pins: one that enables recording, and the other that plays back what was previously recorded.

isd1820.jpg
// Instantiate a ISD1820 on digital pins 2 (play) and 3 (record)
// This example was tested on the Grove Recorder.
upm::ISD1820* recorder = new upm::ISD1820(2, 3);
// if an argument was specified (any argument), go into record mode,
// else playback a previously recorded sample
cout << "Supply any argument to the command line to record." << endl;
cout << "Running this example without arguments will play back any " << endl;
cout << "previously recorded sound." << endl;
cout << "There is approximately 10 seconds of recording time." << endl;
cout << endl;
bool doRecord = false;
if (argc > 1)
doRecord = true;
// depending on what was selected, do it, and sleep for 15 seconds
if (doRecord)
recorder->record(true);
else
recorder->play(true);
// There are about 10 seconds of recording/playback time, so we will
// sleep for a little extra time.
cout << "Sleeping for 15 seconds..." << endl;
sleep(15);
// now, turn off whatever we were doing.
if (doRecord)
recorder->record(false);
else
recorder->play(false);

Public Member Functions

 ISD1820 (int playPin, int recPin)
 
 ~ISD1820 ()
 
void play (bool enable)
 
void record (bool enable)
 

Constructor & Destructor Documentation

ISD1820 ( int  playPin,
int  recPin 
)

ISD1820 constructor

Parameters
recPinPin to use for recording
playPinPin to use for playback
~ISD1820 ( )

ISD1820 destructor

Member Function Documentation

void play ( bool  enable)

Starts or stops playback

Parameters
enableStarts playback if true, stops if false
void record ( bool  enable)

Starts or stops recording

Parameters
enableStarts recording if true, stops if false

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