Using char instead of string (this is in the main loop for now).
//Extract Date and Time from stringbuffer (which is of type char)
char timeBuffer[9];
timeBuffer[9] = '\0';
for (int x = 5; x < 5 + dateLength; x++)
{
timeBuffer[x] = StringBuffer[x];
Serial.print(StringBuffer[x]); //prints separate chars
}
Serial.println("");
Serial.print("timeBuffer printed output is ");
Serial.println(timeBuffer);
Output is
10041245
timeBuffer printed output is
Separate characters are printed, but timeBuffer is not printed even when I added a null char to the end.
//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?
I'm bored asking to see all of your code now, so I won't do it again
Exactly. Snippets-are-us is down the road a ways. If you want to post just snippets, go there. If you want help here, post all of your code, AND the exact error messages.
Lakes:
So to pass an array (pointer?) name, you have to put a the "star" character in front of it.
No. To declare that something is a pointer, you put a star '*' in front of the variable name in the declaration. That's what's happening in those function declarations.