Hello all
This is just a 'conversion question'. Don't really want to post the entire code, because its HUGE and full of peoples phone numbers etc. But, if we can't get a solution, then I will have to try and edit it down.
My code receives data over Websockets and displays the results in the serial monitor as follows:
I have routine that obtains the Websockets data...
void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length) { // When a WebSocket message is received
This is then checked to see if its a disconnect request, connect request or text request. If it's a text request then....
- case WStype_TEXT: // if new text data is received*
- Serial.printf("[%u] get Text: %s\n", num, payload);*
Each set of data arriving uses the first 3 characters to determine what I want to do with the data. In this case here, 'TXT' means it's my text data (1000+ characters).
This prints perfectly once it's arrived on the serial debug screen:
- Serial.println("Incoming .txt data....");*
- Serial.printf("%s\n", (&payload[3])); // This prints the payload, minus the first three characters ('TXT')*
My stumbling point is how to convert this data to something I can print on the Nextion screen.
This short routine here prints to the Nextion fine:
- NextionSerial.print("t0.txt="");*
- NextionSerial.print("Test text - Hello!");*
- NextionSerial.print(F(""")); NextionSerial.write(0xff); NextionSerial.write(0xff); NextionSerial.write(0xff); // Send the text to the Nextion text page*
Now I just need to convert that 'Test text - Hello!' to be the contents of my Websockets data
I just get constant conversion type errors.
Ideas?