01-25-2020 03:16 PM
Hello! I made a project of remote gate opening by license plate. When the program recognizes the license plate, the gate opens automatically. For the program to work properly, I want the timing to start automatically and the number of parking spaces to be reduced when the gate is open. I think this is the problem between Event Structure and Case Structure. How can I fix it?
Best regards and thank you!
01-25-2020 03:32 PM
You need to rethink your overall architecture. You have numerous parallel loops each doing their own thing. You are relying on local variables to pass information between them which will probably give you problems with race conditions.
Three of your loops have event structures in them, and one of them is in a loop that will never end.
You should be able to write your whole program in a single loop with a state diagram architecture.
One state is idle waiting for an event.
When a car is detected, decode the license plate and decide what action to take next.
If it is open the gate, then open it and decrement your counter that you store in a shift register.
Close the gate,
Return to your idle state.
01-25-2020 04:39 PM
Thank You for your reply!
I know, this is not very good project, becuase I am beginneing user of LabVIEW :/. There is a possiblity to fix this project? The deadline is near and I don't have enough time to do a whole new project 😞
Thank You!
01-26-2020 12:05 AM
Of course it is possible. You don't have that much code in it now, and if you plan your state machine properly, as in plan it on paper first, it will not take that much code to implement. Less than what you have now.
01-26-2020 07:44 PM
01-27-2020 12:57 PM
Thank You!
It helped me a lot!
01-29-2020 04:11 AM
@tomekszt wrote:
Thank You!
It helped me a lot!
That's great! If your problem is solved, please use the Mark as Solution button to identify the post(s) that solved the problem, so that the thread will be marked as solved.
If it's not solved, don't click that (yet) - feel free to ask more questions about the same problem.
As a shameless note to a new forum member, we also tend to show thanks via the kudos (star button) option 😉