Need to send a string to a device at regular intervals
dmenke
Posts: 25
I need to poll a projector for lamp status on a regular basis, but nothing I try seems to work.
I tried a WAIT in the runtime loop, and nothing happens.
I tried the following code in the runtime, and nothing happens:
IF (TIME='??:??:?0') // Execute every 10 seconds
{
WAIT 11
SEND_STRING dvVideoProjectorIP,"'TLPS 1',13"
}
I tried a WAIT in the runtime loop, and nothing happens.
I tried the following code in the runtime, and nothing happens:
IF (TIME='??:??:?0') // Execute every 10 seconds
{
WAIT 11
SEND_STRING dvVideoProjectorIP,"'TLPS 1',13"
}
0
Comments
However, you can do it in define program, there's nothing wrong with that if that's what you want.
Looks like you are trying to send the string every 11.1 seconds. Try this:
This will not start a new wait each time define_program runs, even though it might look like it will. Waits will not "stack" when encountered repeatedly in define_program or in functions, subroutines, or events.
Now, as for your
this: '??:??:?0', is a string literal. You are not using wild card characters, you are using question mark characters. I don't believe wild cards work within Netlinx programming. Look in the Netlinx documentation for various string parsing functions such as LEFT_STRING, RIGHT_STRING, MID_STRING to see how to extract a character from a particular expression.
Check out COMPARE_STRING(). I'm not sure of the overhead involved, but it does allow wildcard searching, but not the multicharacter wildcard (*).
Jeff
Ok, that's one I've not used.
Instead of we should have Or, could use RIGHT_STRING (or other functions)about as easily.
TIME_TO_SECOND(TIME)
instead of the string parsing.
Define_Program
wait 10
{
//poll the device
}
By naming the wait you can manipulate it but it still works the same.
My bad.
This post is at least 10 characters.
Doug