0

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!

askedJun 6, 2016 at 17:09
Phil's user avatar
2
  • INFO isn't an array - it's a String.CommentedJun 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 inputCommentedJun 6, 2016 at 21:55

1 Answer1

1

I think you should better read about theString Object and don't mix this up withstring as char array.

answeredJun 15, 2016 at 12:05
PowerStat's user avatar
1
  • That is not an answer!CommentedFeb 28, 2022 at 10:26

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.