I am planning to store data I obtained from LoRa RFM 95 shield in table form.
Here is how I process my received data.
if (rf95.available())
{
// Should be a message for us now
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf95.recv(buf, &len))
{
Serial.print("Got: ");
Serial.println((char*)buf);
strcpy (tempChars,buf);
char * strtokIndx;
strtokIndx = strtok (tempChars,",");
strcpy (messageFromPC,strtokIndx);
strtokIndx = strtok (NULL,",");
strcpy(sID,strtokIndx);
strtokIndx = strtok (NULL,",");
strcpy(dID,strtokIndx);
strtokIndx = strtok (NULL,",");
strcpy(floatFromPC,strtokIndx);
strtokIndx = strtok("NULL",",");
strcpy(packetn,strtokIndx);
strtokIndx = strtok("NULL",",");
strcpy(route,strtokIndx);
else
{
Serial.println("Receive failed");
}
}
Someone provided me with this but I need further explanation..
typedef struct myDataSet_t {
char messageFromPC [2];
char sID[3];
char dID[3];
char pRssI[5];
char route[3];
} myDataSet_t;
myDataSet_t myDatatable[5];
I am planning to arrange the data as example below:
message|| sID || dID || pRssI||route
a || AB || UQ || -129 || AB
b ||NB || OU|| -123 || JA
in which consists of char n int types and I want to overwrite the values whenever I could.. The question is how do I "inform" that there will be not only one message receive? and how do I assign them in sequence accordingly? for loop does not work?