Serial communication Nextion

If you just want to get rid of the non printable stuff...

change to...

    byte b;
    while (mySerial.available() > 0) 
    {
      b = mySerial.read();
      if (b < 128)
        datanextion += char(b);
    }

It's most likely that you are receiving the product number as binary... so it would be better to decode that.

1 Like