HI all, I wonder if anyone can help me with this problem . This is fragment from the example code for a ESP32 HUZZAH Feather.
File > examples > examples for adafruit esp feather > esp async UDP > asyncUDPserver
Serial.print(", Length: ");
Serial.print(packet.length());
Serial.print(", Data: ");
Serial.write(packet.data(), packet.length());
Serial.println();
//reply to the client
packet.printf("Got %u bytes of data", packet.length());
// attempt to parse what was received in packet.data()
String s = packet.data(); // error here.
//invalid conversion from 'uint8_t* {aka unsigned char*}' to 'const char*' [-fpermissive]
I am simply trying to get at the packet.data() so that I can work with it, extract substrings, etc but I am at a loss as to why I can't get the data into a simple string. I suspect i need to get it into a byte array but I don't know how to do this. I am a terrible beginner. I note that the Serial.write(packet.data(), packet.length()) statement above has no trouble accepting the packet.data().
Anyone able to help?
dazza000