the bizarre output of a rgb color

You describe that for the shown output you sent via mobile “0,19,255”.
Yet in the shown output that obviously is only the second part of a longer sequence of numbers sent, which starts with “0,21”.

Assuming that what you send is always of the format you have described, i.e. three numbers, separated by two “,”, the shown output is most likely the result of you sending first “0,21,255” and then another triplet “0,19,255”.

These two messages together would end up in an input buffer “0,21,2550,19,255”.

Now I have to do some speculation. Most parsers, when told to look for numbers within the buffer, will look for digits followed by non-digits. They would end up yielding “0,21,2550”.

Without knowing details of the parsers working it is hard to say how to fix your problem.
I would however definitly experiment with sending triplets which end in a non-digit.

For example:

“0,21,255 “

If none of them work you might need to explicitly expect the non-digit, i.e. between triplets of numbers read a character and either ignore it or compare it to ” ,”, ” ” or “;” for additional self-checking features.

(Writing this I rely on user zdf not intending to make an answer, because while I did spot the “2550” as “255””0″, zdf spotted the only two “,” inside the question body in sample input, which I missed. I will of course adapt my answer to one created by zdf, to not use their contribution without their consent.)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top