Timeline for Parsing Integers from Serial data stream
Current License: CC BY-SA 4.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 23, 2019 at 19:37 | history | edited | VE7JRO | CC BY-SA 4.0 |
Fixed syntax highlighting.
|
| Apr 24, 2019 at 20:04 | comment | added | VE7JRO |
Try sending a \n at the end of your data: "<1,1,1,1,1,512>\n"
|
|
| Apr 24, 2019 at 20:01 | comment | added | PatchBOTS | I edited the OP with the results of your second sketch. Mixed results. | |
| Apr 24, 2019 at 18:41 | history | edited | VE7JRO | CC BY-SA 4.0 |
Added a second sketch because of comments made.
|
| Apr 24, 2019 at 18:13 | comment | added | PatchBOTS | I edited the OP with my code. Getting an error on one of the lines | |
| Apr 24, 2019 at 17:51 | comment | added | PatchBOTS | Thank you so much, this was very helpful! | |
| Apr 24, 2019 at 17:50 | vote | accept | PatchBOTS | ||
| Apr 24, 2019 at 17:30 | comment | added | VE7JRO |
Yes, you could do that, or just use the array directly e.g. if(myArray[0] > 1){ //do something}.
|
|
| Apr 24, 2019 at 14:28 | comment | added | PatchBOTS | So would this give me the variables from the the array? trig1 = myArray[1]; trig2 = myArray[2]; trig3 = myArray[3]; trig4 = myArray[4]; trig5 = myArray[5]; pot = myArray[6]; I can't test right now otherwise I would just test myself. Excited to find the answer! | |
| Apr 24, 2019 at 14:09 | comment | added | VE7JRO |
All the code is in setup() for testing purposes. The integer array contains the 6 integers and can be used as variables in the rest of your sketch. Every time you receive new data, it should be parsed using strtok().
|
|
| Apr 24, 2019 at 12:55 | comment | added | PatchBOTS | This is very helpful! I think I understand most of it. Does this really all run in the setup? I don't want to print the array, but rather use each int as a variable in the rest of my sketch. Is there a function to use for that? Sorry I'm a bit of a beginner and just barely grasping this as a whole | |
| Apr 24, 2019 at 2:30 | history | answered | VE7JRO | CC BY-SA 4.0 |