error: invalid conversion from 'const char*' to 'char' [-fpermissive]

I've made a few global vars / constants to handle serial port input, ran into this error

junk.ino: In function 'void loop()': junk.ino:35:13: error: invalid conversion from 'const char*' to 'char' [-fpermissive] Error compiling.

I didn't declare this as a const char, just char so I could put new char data into it but, this error is got me confused?

bool serControl       = false;
int serIntIn          = 0;
char serCharIn     ="";
String serStringIn    = "";
const int SER_RET_INT       = 1;
const int SER_RET_CHAR      = 2;
const int SER_RET_STRING    = 3;

void setup() 
{
  
    Serial.begin(19200);    // opens serial port, sets data rate to 9600 bps
  //attachInterrupt(1, intCnt, RISING  ); // syntax attachInterrupt(interrupt, ISR, mode)
  //interrupts();
  //tickEvent = t.every(2000, intCnt); //doFreeRun is controlled by timer 
  
    

}

void loop() {
serIntIn    = 0;
serCharIn   = "";
serStringIn = "";



}

Using "const" prevents you from changing the variable in code.

Remove const from variables you change.

Edit, my mistake

.

Hopefully the "edit my mistake" was you realized that I don't have const before the error because the error is on line 35 which is

serCharIn   = "";

it's declared as a char not a const char?

If I misunderstood your post then please clarify

I made a mistake.

You need ’ ’ rather than " "

bool serControl       = false;
int serIntIn          = 0;
char serCharIn        = ' ';  //<<<<<<< use ' apostrophes 
String serStringIn    = "";
const int SER_RET_INT       = 1;
const int SER_RET_CHAR      = 2;
const int SER_RET_STRING    = 3;

void setup() 
{
  Serial.begin(19200); // opens serial port, sets data rate to 9600 bps
  //attachInterrupt(1, intCnt, RISING  ); // syntax attachInterrupt(interrupt, ISR, mode)
  //interrupts();
  //tickEvent = t.every(2000, intCnt); //doFreeRun is controlled by timer 
}
void loop() {
  serIntIn    = 0;
  serCharIn   = ''; //<<<<<<< use ' apostrophes
  serStringIn = "";
}

Can I ask why I would need '' verses "" for a char verses a string?

Actually I tried it with single quotes and got the same error

If I just change the declaration I get.....

Build options changed, rebuilding all junk.ino:15:25: error: empty character constant junk.ino: In function 'void loop()': junk.ino:35:13: error: invalid conversion from 'const char*' to 'char' [-fpermissive] Error compiling.

If I change the initialization junk.ino:35:15: error: empty character constant junk.ino:15:25: error: invalid conversion from 'const char*' to 'char' [-fpermissive] Error compiling.

and if I change both I still have... junk.ino:15:25: error: empty character constant junk.ino:35:15: error: empty character constant Error compiling.

' char, is a single character variable like 'C' or '$'. " String, is a string of characters like "now is the time for all good men to come to the aid of the party"

See: https://www.arduino.cc/en/Reference/Char

You didn’t get “the same error”, at all.

You tried to define a char variable with

char serCharIn = ‘’ ;

which is invalid. That is two single quotes there, and there has to be a char constant between them. One char. Not zero chars. That’s what “junk.ino:35:15: error: empty character constant” says.

A char is one char

A const char* is a pointer to the beginning of an array of chars ( which might be an array consisting of one element ).

larryd:
You need ’ ’ rather than " "

bool serControl       = false;

int serIntIn          = 0;
char serCharIn        = ’ ';  //<<<<<<< use ’ apostrophes
String serStringIn    = “”;
const int SER_RET_INT      = 1;
const int SER_RET_CHAR      = 2;
const int SER_RET_STRING    = 3;

void setup()
{
  Serial.begin(19200); // opens serial port, sets data rate to 9600 bps
  //attachInterrupt(1, intCnt, RISING  ); // syntax attachInterrupt(interrupt, ISR, mode)
  //interrupts();
  //tickEvent = t.every(2000, intCnt); //doFreeRun is controlled by timer
}
void loop() {
  serIntIn    = 0;
  serCharIn  = ‘’; //<<<<<<< use ’ apostrophes
  serStringIn = “”;
}

This is true, I had the same issue. Doing that fixed it for my code.