2

I would like to send information between my Arduino and my computer. Is there a way to send multiple variables from one Arduino? If so, how would I go about separating the variables?

1
2

You have three options for what you want to achieve (if I understand it right):

  • Have a fixed length for each variable: If I know each number is going to be two digits, I can send "1234" and the other side can figure out the numbers are "12" and "34".
  • Have a delimiter character: Have a character that signals a new variable. For example: "213|1234" would translate into "213" and "1234". You could even use the newline character to signal a new line (with Serial.println();).
  • Do some sort of validation to separate the data: If sending a favorite number and favorite color, I can send "12RED345BLUE" and the other side it can find that it's "12" (both numbers), then "RED" (all letters), then "345" (three numbers), and finally "BLUE" (again, all letters).
4
  • ♦ can we do this like this as well? 'LI5' or something like this? 'LA4|LI5' or something like Serial.println('LA4|LI5'); Serial.println('LT2|LP3|LM5|LR4|LI6'); //close reverse will open thanks in advanced.
    – Frank
    Sep 3 '15 at 7:57
  • @Frank'sDesig'Nature there's no reason you can't do that; you would just have to have the appropriate processing on the other side to handle that Sep 4 '15 at 1:40
  • im not being allow to comment or edit so this is the only way for me to input my next comment "i really hate how this website works" Ok so now if i was to flood the serial with something like this: `gfhvfglfngvern98t34u05u305v4up0653utvp53t4t56526vgf5gvsd4gv6h4d65h4d63hbd4hb354g35gb435vb4zf35gdf35gb4d3v5h4vg3v5hb4fg6z24gv6dfgv4fd65vg2652f6g5hb74ki6k57n6v54sh64yul6oh4;g6fjd4g6wr5cg4yrdb68oin7n6ubj84g6jnujg4hm;l62g4kn6gfj42mjh6l54g6k5gf4dbhv16d5sg41tb6uh541jh1j34nfj35ffff4n4j2h3n14b5jgn352ghj3kj18hbuni5dj6tui5dty32hf3h1bgh3gfhvfglfngvern98t34u05u305v4@p0653utvp53t4t56526vgf5gvsd4gv6h4d65h4d63hbd
    – Frank
    Sep 4 '15 at 18:04
  • @Frank'sDesig'Nature (when I converted this into a comment some of your message got cut off) I'm not sure exactly what you're saying. Can you clarify? Sep 18 '15 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.