Having problems with getting data to show on LCD-screen (4x20)

The first thing I noticed looking at your code was the blank in your event subscribtion

  Particle.subscribe("hook-response/Pub Trans", parseData, MY_DEVICES);

IIRC you should not use blanks in the subscription (nor in the publish).

https://docs.particle.io/reference/firmware/photon/#particle-publish-

Also be aware that this may - over time - lead to problematic behaviour due to heap fragmentation

    char *mutableCopy = strdup(data);

The final free(mutableCopy) won't prevent fragmentation. I'd rather suggest

    char mutableCopy[strlen(data)+1];
    strcpy(mutableCopy, data);

And what is this line supposed to do :confused:?

String data = String(data);

Apart from the fact that it doesn't make sense, you should also avoid using String due to it's internal use of dynamic memory and consequently to potential for heap fragmentation again.

4 Likes