Chad Miller / EasyVR

Dependents:   Lab4

Embed: (wiki syntax)

« Back to documentation index

EasyVR Class Reference

EasyVR Class Reference

EasyVR class for ECE 4180 lab 4. More...

#include <easyvr.h>

Public Member Functions

 EasyVR (PinName tx, PinName rx)
 EasyVR constructor.
void wakeup ()
 Wakes up the EasyVR by sending it a "break" signal until a reply of "success" has been received.
void setup (int lang, int timeout)
 Sets up the EasyVR.
void send (char byte)
 Sends a single byte to the EasyVR.
char receive ()
 Receives a single byte from the EasyVR.
void baud (int rate)
 Sets the EasyVR's baud rate.

Detailed Description

EasyVR class for ECE 4180 lab 4.

Used for interfacing with an EasyVR module.

Example:

 #include "mbed.h"
 #include "easyvr.h"

 EasyVR easyVR( p27, p28 );
 
 int main()
 {
     easyVR.wakeup();
     easyVR.setup();
 }

Definition at line 87 of file easyvr.h.


Constructor & Destructor Documentation

EasyVR ( PinName  tx,
PinName  rx 
)

EasyVR constructor.

Initializes the serial interface for the EasyVR module.

Parameters:
txThe TX pin on the mbed that should be used. This connects to the EasyVR's RX pin.
rxThe RX pin on the mbed that should be used. This connects to the EasyVR's TX pin.

Definition at line 3 of file easyvr.cpp.


Member Function Documentation

void baud ( int  rate )

Sets the EasyVR's baud rate.

For speech recognition, this must be exactly 9600.

Parameters:
rateThe baud rate the EasyVR should communicate with.
See also:
Serial.baud()

Definition at line 64 of file easyvr.cpp.

char receive (  )

Receives a single byte from the EasyVR.

This is most commonly used to receive signals from the EasyVR. Note that this is just a wrapper for the EasyVR's serial interface's getc() function.

Be aware that this is a blocking method - it will stall the program until a byte is received!

Returns:
A single byte from the EasyVR.
See also:
Serial.putc()

Definition at line 59 of file easyvr.cpp.

void send ( char  byte )

Sends a single byte to the EasyVR.

This is most commonly used to send commands and parameters for those commands. Note that this is just a wrapper for the EasyVR's serial interface's putc() function.

Parameters:
byteThe byte to be sent.
See also:
Serial.putc()

Definition at line 54 of file easyvr.cpp.

void setup ( int  lang,
int  timeout 
)

Sets up the EasyVR.

This includes ensuring the EasyVR module is a valid EasyVR device, setting its timeout value, and its language.

Parameters:
langThe language to be used, as an encoded integer. i.e. 0 is 'A', 1 is 'B', and so forth.
timeoutThe timeout to be used, in seconds, as an encoded integer.

Definition at line 17 of file easyvr.cpp.

void wakeup (  )

Wakes up the EasyVR by sending it a "break" signal until a reply of "success" has been received.

Definition at line 8 of file easyvr.cpp.