#include <SerialCommunication.h>
|
| | 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[]) |
| |
◆ SerialCommunication()
| SerialCommunication::SerialCommunication |
( |
PinName |
TX, |
|
|
PinName |
RX, |
|
|
int |
baud |
|
) |
| |
|
inline |
Construct a new Serial Communication Object.
- Parameters
-
| TX | is TX pin or USBTX |
| RX | is RX pin or USBRX |
| baud | Set baud rate (optional, default is 9600) |
◆ PCRead()
| bool SerialCommunication::PCRead |
( |
char |
message[] | ) |
|
|
inline |
Check for new input into Serial monitor.
- Parameters
-
| message | is 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
-
| message | is 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
-
| message | is a char array[] intialized in the main function and the new message will be stored into that array if there is a new message |
| sizeOfMessage | size of the char array[] |
| sleep_fordelay | Used 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: