TR-mbed 1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SerialCommunication Class Reference

#include <SerialCommunication.h>

Inheritance diagram for SerialCommunication:

Public Member Functions

 SerialCommunication (PinName TX, PinName RX, int baud)
 Construct a new Serial Communication Object.
 
bool PCRead (char message[])
 Check for new input into Serial monitor.
 
bool update (char message[], int sizeOfMessage, int sleep_fordelay)
 Check for new data into Serial.
 
int toNum (char message[])
 Check whether message is a number. Works with negatives as well.
 
bool strCompare (char word1[], char word2[])
 

Constructor & Destructor Documentation

◆ SerialCommunication()

SerialCommunication::SerialCommunication ( PinName  TX,
PinName  RX,
int  baud 
)
inline

Construct a new Serial Communication Object.

Parameters
TXis TX pin or USBTX
RXis RX pin or USBRX
baudSet baud rate (optional, default is 9600)

Member Function Documentation

◆ PCRead()

bool SerialCommunication::PCRead ( char  message[])
inline

Check for new input into Serial monitor.

Parameters
messageis a char array[] intialized in the main function of which the message will be filled into only when '\' is sent.
Returns
Returns True if new message

◆ strCompare()

bool SerialCommunication::strCompare ( char  word1[],
char  word2[] 
)
inline

◆ toNum()

int SerialCommunication::toNum ( char  message[])
inline

Check whether message is a number. Works with negatives as well.

Parameters
messageis a string of chars to convert
Returns
integer if it is a number, -999 if not convertable.

◆ update()

bool SerialCommunication::update ( char  message[],
int  sizeOfMessage,
int  sleep_fordelay 
)
inline

Check for new data into Serial.

Parameters
messageis a char array[] intialized in the main function and the new message will be stored into that array if there is a new message
sizeOfMessagesize of the char array[]
sleep_fordelayUsed to calculate the delay which is ESSENTIAL for reading data correctly. As a general rule it should be sizeOfMessage + 10
Returns
Returns True if new message

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