Hi,
I'm trying to parse an in coming string for example '01:2.7:300:4'.
However, I am get an error
incompatible types in assignment of 'uint8_t [251] {aka unsigned char [251]}' to 'char [251]'
The error is believe is being cause by the line.
stringToParse = sx1272.packet_received.data;
The type of sx1272.packet_received.data is uint8_t [251].
Could anybody help resolve?
Thanks
const char *delim = ":"; //a comma is the delimiter
uint8_t stringToParse[251];
/*!
Setup function
*/
void setup() {
Serial.begin(115200);
// Power ON the module
sx1272.ON();
}
//! Main application loop
void loop() {
e = sx1272.receivePacketTimeout(10000);
e = sx1272.getRSSIpacket();
char *firstItem;
char *secondItem;
char *thirdItem;
char *fourthItem;
char *fifthItem;
stringToParse = sx1272.packet_received.data;
firstItem = strtok(stringToParse,delim);
secondItem = strtok(NULL,delim);
thirdItem = strtok(NULL,delim);
fourthItem = strtok(NULL,delim);
fifthItem = strtok(NULL,delim);
Serial.print ("First item in string: ");
Serial.println(firstItem);
Serial.print ("Second item in string: ");
Serial.println(secondItem);
Serial.print ("Third item in string: ");
Serial.println(thirdItem);
Serial.print ("Fourth item in string: ");
Serial.println(fourthItem);
Serial.print ("Fifth item in string: ");
Serial.println(fifthItem);
}