heyy every budy ... im trying to save 2 float number whom im receiving via xbee ... im using packet mrkers method {} () /// im able to save them in 2 variables but my code is very long so i was woundering if any one can help me minimizing it ... here is my code :
I can't see that that works at all - are you sure?
It is because the [ i ] got stripped out by the forum software, because the code is not in a code box. With the index in place, the code is perfectly valid.
heyy its me again ... i tryied paulS code and it works perfect for the first marker /// but for some reson its not getting the secound number itryed several wayes to modify the code to accept 2 markere with no succes here is my last code it only print the first number :
If inChar IS a { it is NOT a ( by definition. The && clause is not needed.
Look at your tests. What causes a character to be written into the inData2 array?
Nothing. If the character is not a {, }, (, or ), it will be stored in inData (if there is room).
And this is OK. It just means that in the if(started2 && ended2) block, you need to use inData instead of inData2. It also means that inData2 and index2 are not needed.
It also means that started2 and ended2 are not needed.
The only issue here is that in the if(started && ended) block, you do not know whether the packet markers were { and } or ( and ). If this is important, add a char variable to store the start marker, and set it in the first if block (to inChar), and test that character in the if(started && ended) block.