Works in main loop
//Extract Date and Time from stringbuffer (which is of type char)
char timeBuffer[15];
timeBuffer[9] = '\0';
for (int x = 5; x < 4 + dateLength; x++)
{
timeBuffer[x - 5] = StringBuffer[x];
Serial.print(StringBuffer[x]); //prints separate chars
}
Serial.println("");
Serial.print("timeBuffer printed output is ");
Serial.println(timeBuffer);
In Function
void getDateTime() {
//Extract Date and Time from stringbuffer (which is of type char)
char timeBuffer[15];
timeBuffer[9] = '\0';
for (int x = 5; x < 4 + dateLength; x++)
{
timeBuffer[x - 5] = StringBuffer[x];
Serial.print(StringBuffer[x]); //prints separate chars
}
Serial.println("");
Serial.print("timeBuffer printed output is ");
Serial.println(timeBuffer);
} // endFunction
error is invalid types char[int] for array subscript, its still having a problem with seeing the stringbuffer variable in the function.
Which leads back to my original question - how do I get the Function to "see" the StringBuffer array (pointer?) variable in the main loop?