Probing the value coming out of the subtraction after the feedback node will tell you the exact loop time. You can even plop down a waveform chart like I did to see how the value changes over time.
Then that makes total sense and is exactly what RavensFan described. Your loop is running at 0ms, 1ms, or 2ms. Notice how your probe has E-3 that means 1 * 10^-3. 99% of the time you get 0 messages in 1ms which is dividing by 0 which is where INF comes from. Some times you get 1 message in 1ms. If you get one message in 1ms then you are getting 1000 messages in one second. You are going to need more logic to track the number of messages, over a longer period of time, or slow down your loop rate, which I'm guessing you don't want to do because it is used in a messenging scheme. Maybe this would be a good place for an action engine, or functional global which can add new messages as it sees them.
Ok, all this logic is in a case structure. Can you change the time for a case structure?
And I've never done anything with an action engine?
Here is an example using the other technique I mentioned. Basically we keep track of how many As we see as we go along, and then once a second we reset the number back to 0. There are still a couple of flaws with this design. In my case I'm just looking for A which is a single character. You might be looking for a series of characters, and if your message comes in, but cuts the message into two pieces, then this code detecting the start of the message might not be all there at once. More logic could be written fix this but it probably isn't an issue for a small message like "10". The action engine approach is a good one if you have time to learn about it.
So yes I am in a time crunch and really don't have time to learn about the action engine stuff, although I certainly will read through it when I have the time.
Hooovahh, what would I need to change in the code you just posted to be able to check for a space at the beginning of the string. I can just have the robot send the strings with a space at the beginning so it'll be easier to detect an incoming string.
Well does the string start with a return character and then a space? If so then that is what you would search for instead of "A". You can just use a space instead of A but then you'll find all spaces, and since I don't know the typical strings you will see I can't say for sure if that would find other spaces that aren't the start of your message.