Switch case problem

Hello, before i always used if...else, but i wanted to try switch case... But i don't know why there are a problem with my code :frowning: Help me plz.

if(mySerial.available()) {
  sms= mySerial.read();
  Serial.write(sms);
  switch(sms) {
    case 'avance':
          Avance();Move=1;
          break;
    case 'stop':
          motorStop();
          Move=0;
          break;
    case 'droite':
          Droite();
          delay(100);
          motorStop();
          break;
    case 'gauche':
          Gauche();
          delay(100);
          motorStop();
          break;
    case 'recule':
          Recule();
          Move=2;
          break;
    case 'Dis':
          mySerial.write(dist);
          break;
    case 'rem0':
          dist=0;
          break;
  }}

Because you are taking a single ASCII byte and compairing it with what?
Single quotes should only be used with single characters.

i want compare string

Then you can not do it in a switch statement, nor with constants with single quotes.

Then you can not do it in a switch statement, nor with constants with single quotes.

That's not strictly true - for instance 'stop' would fit in an unsigned long, but 'avance' would not.

True but he is only ever reading a single byte from the serial port.

Good point.

ok, thx