I'm attempting to use this library (it is actually an amended official library) GitHub - i-am-bigmike/HardwareSerial_flow_control: Arduino Hardware Serial with Flow Control
And a very useful amendment it makes: It allows hardware flow control via CTS and RTS using the standard Serial commands.
The problem is, that when I replace all of the required files, in the location that they are on my computer, Arduino IDE has a problem and says:
Blockquote
C:\Users----\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/HardwareSerial.h:146: undefined reference toHardwareSerial::begin(unsigned long, unsigned char, signed char, signed char)' C:\Users\----\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/HardwareSerial.h:148: undefined reference toHardwareSerial::begin(unsigned long, unsigned char, signed char, signed char)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
Blockquote
I am using the example that comes with this, in fact any Serial.begin brings the error:
/* Flow control test tx 1.0.0
* (C) 26-03-2019 Michele Bighignoli
*
*/
#define SerialRecv Serial2
bool rcvExit = false;
char c = '0';
char r;
unsigned long i = 0;
unsigned int m = 0;
unsigned long elapsedTime;
void setup() {
Serial.begin(115200);
Serial.println("Starting up");
SerialRecv.begin(500000, 3, 4); // speed, cts, rts
// Wait for start signal
while (SerialRecv.read() != '{') {
}
elapsedTime = millis();
}
void loop() {
if (!rcvExit) {
while (SerialRecv.available() > 0) {
r = SerialRecv.read();
//delayMicroseconds(5);
//delay(1);
//Serial.print(r);
if (r == '}') {
rcvExit = true;
break;
} else {
if (r != c) {
Serial.print("Error ");
Serial.println(String(r)+" should be "+String(c));
Serial.println(i);
rcvExit = true;
break;
}
c++;
if (c > 'z') {
c = '0';
}
i++;
m++; // Using m and not i % 50000 speeds up the receiving
if (m == 50000) {
Serial.println(i);
m = 0;
}
}
}
} else {
elapsedTime = millis() - elapsedTime;
Serial.print("Elapsed time: ");
Serial.println(elapsedTime);
while (true) {}
}
}
I guess that maybe something has changed in the IDE since then?
Do you know a way to get that to work, or indeed, another library that does a similar thing and allows the user to employ CTS and RTS while reading and writing to a Serial port?