1#ifndef SerialCommunication_hpp
2#define SerialCommunication_hpp
30 if (comdata[0] ==
'\\') {
32 while(message[
i] !=
'\0')
36 if (
update(comdata, 6, 1)) {
38 if (comdata[0] ==
'\\') {
43 while (comdata[z] !=
'\0') {
44 printf(
"%s", comdata);
46 message[index] = comdata[z];
62 bool update(
char message[],
int sizeOfMessage,
int sleep_fordelay) {
64 for (
int i = 0;
i < sizeOfMessage;
i++)
67 ThisThread::sleep_for(std::chrono::milliseconds(sleep_fordelay));
68 read(message, sizeOfMessage);
81 if (message[
i] ==
'-')
83 while(message[
i] !=
'\0') {
84 if (!isdigit(message[
i]))
88 return std::atoi(message);
93 while (word1[
i++] !=
'\0') {
94 if (word1[
i] != word2[
i])
int i
Definition BiCGSTAB_step_by_step.cpp:9
Definition SerialCommunication.h:8
int toNum(char message[])
Check whether message is a number. Works with negatives as well.
Definition SerialCommunication.h:79
bool update(char message[], int sizeOfMessage, int sleep_fordelay)
Check for new data into Serial.
Definition SerialCommunication.h:62
bool PCRead(char message[])
Check for new input into Serial monitor.
Definition SerialCommunication.h:29
SerialCommunication(PinName TX, PinName RX, int baud)
Construct a new Serial Communication Object.
Definition SerialCommunication.h:20
bool strCompare(char word1[], char word2[])
Definition SerialCommunication.h:91