String comparison problem I have this callback function in my Firmata sketch. It receives a string as a character array and does something with it. The problem is, that the string is being sent to the Arduino in T\0h\0i\0s\0 form - after each character there is a \0 terminator. As you can see, my function is switching the d13 LED on if the string incoming is COMMAND. I had tried to use several comparison methods:

strcmp(myString, &quot;COMMAND&quot;) == 1;
myString == &quot;COMMAND&quot;;
strcmp(myString, &quot;COMMAND\0&quot;) == 1;
myString == &quot;COMMAND\0&quot;;
strcmp(myString, &quot;C\0O\0M\0 M\0A\0N\0D\0&quot;) == 1;
myString == &quot;C\0O\0M\0 M\0A\0N\0D\0&quot;;
== with saving the COMMAND to a char array variable;
strcmp with saving the COMMAND to a char array variable;
last two things with converting both the incoming and the needed to a String instance;
comparing a String instance with a directly stated &quot;COMMAND&quot;...

Nothing works. How can I compare the strings workably?
Full Arduino sketch:
#include &lt;Firmata.h&gt;

void stringCallback(char *myString)
{
  if (strcmp(myString, &quot;COMMAND&quot;) == 1) {
    digitalWrite(13, HIGH);
  }
  Firmata.sendString(myString);
}


void sysexCallback(byte command, byte argc, byte *argv)
{
  Firmata.sendSysex(command, argc, argv);
}

void setup()
{
  Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);
  Firmata.attach(STRING_DATA, stringCallback);
  Firmata.attach(START_SYSEX, sysexCallback);
  Firmata.begin(57600);
  pinMode(13, INPUT);
}

void loop()
{
  while (Firmata.available()) {
    Firmata.processInput();
  }
}

Full code of the desktop program:
import pyfirmata, time

class CustomArduino(pyfirmata.Arduino):
    def __init__(self, port: str):
        pyfirmata.Arduino.__init__(self, port)
        self.iterator = pyfirmata.util.Iterator(self)
        self.iterator.start()

        self.add_cmd_handler(0x71, self.receiveString)


    def receiveString(self, *args, **kwargs):
        print(f'Raw: {args}\n'
              f'Received: {pyfirmata.util.two_byte_iter_to_str(args)}')


    def sendString(self, data):
        self.send_sysex(0x71, pyfirmata.util.str_to_two_byte_iter(data))


    def send_sysex(self, sysex_cmd, data=[]):
        &quot;&quot;&quot;
        Sends a SysEx msg.
        :arg sysex_cmd: A sysex command byte
        : arg data: a bytearray of 7-bit bytes of arbitrary data
        &quot;&quot;&quot;
        msg = bytearray([pyfirmata.pyfirmata.START_SYSEX, sysex_cmd])
        msg.extend(data)
        msg.append(pyfirmata.pyfirmata.END_SYSEX)
        self.sp.write(msg)


print('STRING TESTER\nPlease input your COM port: ', end = '')
myCom = str(input())
device = CustomArduino(myCom)

while True: 
    device.sendString(input('Send: '))
    time.sleep(1)

Strange detail: my Arduino is on the COM6 COM-port. If I connect it via my program and send com6 to the arduino, the D13 LED turns on!
As @timemage stated, strcmp returns 0 for equal. Sincerely in the provided code, while you send a message, which contents are not COMMAND, the LED will be turned on.
To get what we need, we must compare strcmp return value with 0! If it equals, then the strings match, and your suggested code is being executed:
void stringCallback(char *myString)
{
  if (strcmp(myString, &quot;COMMAND&quot;) == 0) {
    digitalWrite(13, HIGH);
  }
  Firmata.sendString(myString);
}