So I ran a test of the example you showed me to get the same results without using strtok(). I also have been reading though the links you sent. In the example code string - Arduino Reference it shows how to make an array of string arrays. When I tried to use the asterisk to accomplish the same effect I received a syntax error "invalid conversion from 'int' to 'char*' [-fpermissive]" . Any suggestions on how to set up this incoming data as an array of strings?
#include "heltec.h"
#define BAND 915E6 //you can set band here directly,e.g. 868E6,915E6
char *myData[80];
String deviceType = "";
int id = 0;
int hourRead = 0;
int minRead = 0;
int secRead = 0;
float latRead = 0.0;
float lonRead = 0.0;
float altRead = 0.0;
int sensorRead = 0;
float voltRead = 0.0;
float percRead = 0.0;
float percReadTru = 0.0;
void setup() {
//WIFI Kit series V1 not support Vext control
Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
Serial.begin(115200);
}
void loop()
{
int packetSize = LoRa.parsePacket();
if( packetSize > 0)
{
if( (packetSize + 1)> sizeof(myData)) // plus one, because of the zero-terminator
{
Serial.println( "The message is too long, it does not fit in the buffer");
}
else
{
int i;
for( i = 0; i < packetSize; i++)
{
myData[i] = LoRa.read();
}
myData[i] = '\0'; // add the zero-terminator
deviceType = myData[0];
id = myData[1];
hourRead = myData[2];
minRead = myData[3];
secRead = myData[4];
latRead = myData[5];
lonRead = myData[6];
altRerad = myData[7];
sensorRead = myData[8];
voltRead = myData[9];
percRead = myData[10];
percReadTru = percRead /10.0
}
}
}
void showData() {
Serial.print("Device Type: "); Serial.println(deviceType);
Serial.print("ID: "); Serial.println(id);
Serial.print("Time: "); Serial.print(hourRead); Serial.print(":"); Serial.print(minRead); Serial.print(":"); Serial.println(secRead);
Serial.print("Location: "); Serial.print(latRead); Serial.print(","); Serial.println(lonRead);
Serial.print("Altitude: "); Serial.println(altRead);
Serial.print("Sensor Reading: "); Serial.println(sensorRead);
Serial.print("Voltage: "); Serial.println(voltRead);
Serial.print("Battery: "); Serial.print(percReadTru); Serial.println("%");
}