I am doing some work with a nextion display i have had laying around for a number of years.
Just getting to know the thing a little and found that if it send number values it sends in a little enian fasion over 4 byte. I have writen a small routine that uses a 4 byte array, a long, bitwise or and bit shifting.
Although it works fine in testing it feels a little clunky in code so i was wondering is there a more effective way? The final project is most likely going to be on something like a teensy 4 or arduino mega for the ease of muliple serial ports.
input[0] = nextion.read();;
input[1] = nextion.read();;
input[2] = nextion.read();;
input[3] = nextion.read();;
b = input[3] << 8;
b = b | input[2] << 8;
b = b | input[1] << 8;
b = b | input[0];