I (think I) am trying to iterate through the values of an array and print the string to a tft. I have declared the array of 4 strings, and that works fine. But when I try to print it, I get garbage. Am I missing a nuance of print? Or do I just not understand how to use arrays and strings...?
The code is as follows:
Declarations:
//Active System
char hvacSystems[4][5] = {"Off", "Fan", "Cool", "Heat"};
int activeSystem = 0;
String displayActiveSystem = hvacSystems[activeSystem]; <-- Should now be String "off"
Use (note the fake if statement for the question)
if(systemNeedsToBeCycled){
activeSystem++;
displayActiveSystem = hvacSystems[activeSystem]; <-- Should now be String "Fan"
tft.print(displayActiveSystem);
}
Instead I get random characters most of the time, sometimes nothing.
In case its a memory thing, please know that:
Sketch uses 26,480 bytes (92%) of program storage space. Maximum is 28,672 bytes. Global variables use 1,126 bytes (43%) of dynamic memory, leaving 1,434 bytes for local variables. Maximum is 2,560 bytes.