#include #include SerialCommunicator::SerialCommunicator(HardwareSerial &p_out, int baudRate, int timeout, __SIZE_TYPE__ bufferSize) : Communicator(bufferSize), port(p_out) { port.begin(baudRate); } void SerialCommunicator::sendMessage(int *values, int numberOfValues) { char message[calculateMessageOutSize(numberOfValues)]; parseIDs(values, numberOfValues, message); port.println(message); } void SerialCommunicator::sendMessage(char *message) { port.println(message); } char *SerialCommunicator::receiveMessage() { if (port.available()) { memset(getBuffer(), '\0', getBufferSize()); port.readBytesUntil('\n', getBuffer(), getBufferSize()); } return getBuffer(); }