![]() The reason you were steered away from using String is because the ARV chips have very little RAM and the way that String works is a very bad fit that causes lots of problems that the ones of us that steer you away from the practice have helped many others fix their code. String message = (String)"Rev " + nfigVersion + "," + configData.versionDate In my code I use it: (and it is just fine) I use it for the simple reason that I re-use the same text in several locations, thus building a single string and re-using it is the correct approach. (Such tool is available in all higher languages I know) ![]() It is a useful tool that was added to Arduino, and is the best choice. The suggested format using String concatenation is just fine, and has nothing to do with laziness. What i the correct way to define and concatenate the strings and make them always print correctly?Įventually I found out there was no problem with the printing code, but rather with the data in the structure. There seem to be no relevant difference between the versions, and yet it will always print "Rev 32" I send the same string to the lcd, and get the same outcome. In the new version it always prints out "Rev 32". While in the previous version it printed out the strings as they appear, namely "Rev B60 22-05-15" Serial.println((String)"Rev " + nfigVersion + " " + configData.versionDate) Unfortunately, I could not figure out what made the change. Problem is that while it printed correctly in previous versions of my code, it does not print in a new version, with very little change from previous. To print out, I concatenate several strings into one longer string, and print it out via serial print command. ![]() The strings are defined in the struct as char string, and given string values.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |