[solved] how to set CR within Serial.findUntil()

hi,

in my sketch the program on a Mega2560 shall wait for "OK" or CR on a serial link. The statement for that purpose is

Serial2.findUntil("OK", 10)

This works when the sketch is compiled on a PC with Win7 Home and Arduino IDE 1.6.12.

For field tests I am using a tablet-PC with Win10 home and Arduino IDE 1.6.9. And here I get the error

error: initializing argument 2 of 'bool Stream.findUntil(char* , char*) '  [-fpermissive]

As an alternative I tried an old laptop with Windows-XP and Arduino IDE 1.6.12. But here the compilation fails at all with

collect2.exe: error: ld returned 5 exit status

exit status 1
Fehler beim Kompilieren für das Board Arduino/Genuino Mega or Mega 2560

On Win7 and Win10 the compiler seems to have different settings. But I have no influence on the settings. I guess they are defined during installation.

What shall I do to get the sketch compiled during the field tests?
Unmounting the equipment, bring it back to my lab and compile there with Win7 would be a tedious job.

SupArdu, very confused :confused:

The statement for that purpose is

Serial.findUntil("OK", "\r\n");

SupArdu:
On Win7 and Win10 the compiler seems to have different settings. But I have no influence on the settings. I guess they are defined during installation.

It’s not the operating system, it’s that the different versions of the Arduino IDE (Arduino AVR Boards actually) you have installed have different compiler versions.

SupArdu:
As an alternative I tried an old laptop with Windows-XP and Arduino IDE 1.6.12. But here the compilation fails at all with

collect2.exe: error: ld returned 5 exit status

This actually is an OS specific issue but also can be solved up updating to Arduino IDE 1.8.2, which should work fine for you with XP.

Serial.findUntil("OK", "\r\n");

Gives some annoying warnings. How about:

Serial.findUntil(const_cast<char*>("OK"), const_cast<char*>("\r\n"));

instead?

Thank you for your help :slight_smile:

Now it works

SupArdu