grease_lighting
Well-known member
I am using a character array to add tags to a value output. I do this to format the data into a table to be used in excel. I have declared the array to be adequate size for all the tags used. The contents of these tags get changed frequently and hence end up using more and more Global variable space. What can I do to prevent this from happening. I am aware of the 'F' macro for printing. Is there a means to redefine the character array contents without eating up more of the Global variable space?
Code:
char temp[21] = "0123456789abcdefghik";
void setup() {
strcpy(temp, "wertyuiopasdfghjklbx"); // put your setup code here, to run once:
output();
strcpy(temp, "fghjklbx"); // change the tag
output(); // output next value
strcpy(temp, "wertyui");
strcpy(temp, "wertyjklbx");
strcpy(temp, "wesdfghjklbx");
strcpy(temp, "wertyuiopasdfghjklbx");
strcpy(temp, "zyxwvutsrqponmlkjihg");
strcpy(temp, "wertyuix");
strcpy(temp, "wertyuiopasdfghjklbx");
strcpy(temp, "zyxwvutsqponmlkjihg");
strcpy(temp, "wertyuioasdfghjklbx"); // everytime the contents
strcpy(temp, "zyxwvutsqponmlkjihg"); // get changed, it takes
strcpy(temp, "wertyuioasdfghjklbx"); // up more Global variable
strcpy(temp, "zyxwvutsqponmlkjihg"); // space.
strcpy(temp, "wertyuioasdfghjklbx");
strcpy(temp, "zyxwvutsqponmlkjihg");
strcpy(temp, "wertyuioasdfghjklbx");
}
void loop() {
// put your main code here, to run repeatedly:
}
void outPut() {
Serial.println(temp);
}