I never see any references to stream.parseInt().
I have intentionally coded my serial data to use only integers so when i send the data, currently over serial monitor but ultimately through some form of RF, I simply look for my SOP, Look at the next character to determne where it is coming from since the serial in will ultimately come from potentially 4 different sources and then use parseInt to grab all of the integer data.
So if I send a data stream of <B,100,100,1,1,2300,400,5,4,3653> to the Arduino, I don’t have to do any kind of crazy subtract ‘0’ low byte, high byte, &= translations to get my integers, I just get integers. Since my received data after that initial letter will always be the same number of items, I could even throw a string or other character data in there and handle it in code. For example,
<B,100,100,1,1,2300,400,5,4,3653,Wade>
Once I saw the < and looked at the first letter ‘B’, I know exactly what the format of this stream of data is so I can parseInt for 9 steps and then read the character data. Using a module like the CC1101 from TI handles the error checking issues so I won’t have to worry about that potential problem either since I think checksum would be a little more difficult to manage using this method.
Since I can send a 1 or a 0, this obviously works for boolean data as well.
So PaulS, is there something I should know that would steer me away from this or do you avoid it because it limits the data input to int’s? I just find it so much easier to use. I ask because I have recently seen two of your posts where you reference the exact same code chunk to read serial and I learned a lot from it on how to start and end the read etc but for now am sticking to the parseInt method.