I have been working on this a while and I cannot seem to figure it out. Essentially, I am using the app/server Blynk and their Terminal Widget to sent String inputs to my Arduino board. My code is below: String INFO; String fromTerminal = param.asStr(); int indexstart = fromTerminal.indexOf(","); int indexend = fromTerminal.lastIndexOf(","); int counter = indexstart - indexend; INFO[counter] = fromTerminal;
My thoughts on the code was, based on the number of "," I enter in the string then that will assign my input to an index within the INFO array. However as I have tried several different things, I constantly get errors such as:cannot convert 'String' to 'char' in assignment.Oddly enough if I set: INFO[counter] = fromTerminal.toInt();I dont get an error but I dont think that will allow me to print out my actual input. Any help is much appreciated, thanks!
INFOisn't an array - it's a String.Majenko– Majenko2016-06-06 17:45:31 +00:00CommentedJun 6, 2016 at 17:45- Yeah so I was looking into it further, dumb oversight on my part but I guess you cant dynamically create an array. So I am just going to over initialize the array ie. INFO[20}; even when I only ever input between 5-10 strings, and then just call the index up to how many I inputPhil– Phil2016-06-06 21:55:11 +00:00CommentedJun 6, 2016 at 21:55
1 Answer1
I think you should better read about theString Object and don't mix this up withstring as char array.
Explore related questions
See similar questions with these tags.
