03-12-2015 01:23 PM - edited 03-12-2015 01:23 PM
Why would you need local variables for this?
03-15-2015 01:59 AM
Can you give me an overlay of the state machine?
03-15-2015 06:16 AM
I have designed a state machine VI for my application as you suggested. However i am facing a problem. I have three states mentioned :
1. Waiting for sensors
2. Sensor 1 triggered
3. Sensor 2 triggered
The IR sensors that I'm using stays ON for 2 secs, and when sensor 1 is triggered, i disabled the sensor 2 and incremented the counter and when sensor 2 is triggered, I disabled sensor 1 and decremented the counter.
The problem is that for state 1, how do I wait for both sensors 1 and 2? I tried giving it sequentially using 2 case select functions but that does not work.
I have attached my VI
03-15-2015 06:18 AM
Could you also look at my VI above and suggest a solution ?
03-15-2015 07:05 AM
Hello,
Here's a simple solution. This implies that the state of the first "TRUE" statement will be outputed. You should also put a time delay in the "Waiting for.." case otherwise your CPU will be a 100%.
03-15-2015 08:03 AM
This works when pir 1 is cut followed by pir 2 wherein pir 2 gets disabled, but does not work vice versa (probably due to the linear nature of search 1d array)
03-15-2015 08:32 AM
Ok, I took a look in the code and what you need is a queue state machine which allows you to add more then one state.
03-15-2015 08:33 AM
Could you throw in some more light on that?
03-15-2015 08:45 AM - edited 03-15-2015 08:46 AM
Here's an example (very simple) of the most basic kind of a queue state machine. I suggest that you get familiarized with the queues instead of using the example below (which is using array for the queue). I disconnected the typedef.
03-15-2015 08:57 AM
I shall look up on queues, but the above vi doesnt seem to work