warning: multi-character character constant [-Wmultichar]

I get this error: warning: multi-character character constant [-Wmultichar]

String gpsData = "";
void gpsUpdate(){
delay(1);
while(Serial.available()){
char in = Serial.read();
if(in == '$'){
Serial.println(gpsData);
gpsData = "$";
} else if(in != '\n\r'){
gpsData.concat(in);
}
}

Please post the whole program and the full error message using code tags when you do

} else if(in != '\n\r'){

At a guess this is the problem. A char, denoted by single quotes, can only hold one character, not two as in the code

1 Like