LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect the correct sequence of boolean switches pushed

Solved!
Go to solution

Here's a code snippet that you can drag and drop to a LV 2009 block diagram.

 

Kurt

 

Button Sequence Example 9-1-kb_BD.png

0 Kudos
Message 11 of 18
(1,454 Views)

Hey Kurt

 

I will try to incorporate your code into my vi.

 

I will go with the first vi you attached earlier.

 

Get rid of the while loop

 

Thanks for the help.

 

I will post the final product when done.

 

 

0 Kudos
Message 12 of 18
(1,428 Views)

Hey

 

Here is the final VI

 

I attached version 9

version 13 and a pdf directions doc

 

Thanks for all your help!

0 Kudos
Message 13 of 18
(1,388 Views)

Why are you resisting using the state machine for this? You could to all of that on a much simpler code structure.

 

If I had to modify your code, I'd scrap it and reprogram it. too complex and your block diagram is MASSIVE.

0 Kudos
Message 14 of 18
(1,336 Views)

I have never used or programmed a state machine

 

I am not sure how to begin.

0 Kudos
Message 15 of 18
(1,324 Views)

Start by reading this: Application Design Patterns: State Machines.  If you look in the project templates, there should be a simple state machine to give you a start.  State Machines can be really simple and are very powerful.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 16 of 18
(1,322 Views)

I get it.

So my states:

 

  • Initialize transition black to....
  • Red/Process button sequence
  • Blue/Process button sequence
  • Yellow/ Process button sequence
  • Random/Process button sequence
  • Interupt Process button sequence if error
  • Display pop-up/write to file for successful trial
  • Display pop-up/write to file for unseccussful trial
  • Reset or Stop

 

All can be done using this architecture?

 

45ee74b4579.gif

 

It would be easier now that i know what to do with the coding

 

Thanks!

0 Kudos
Message 17 of 18
(1,310 Views)

Yes. You can use those states to do everything you need to. If you need more states, that's fine. You can have an infinate number of them. Think of a flowchart when you design it.

 

I would strongly suggest using a 'Wait on Event" state and place a Event Structure within that state so your not pooling and using up CPU resources. Look them up. Another powerful tool you can use with the State Machine.

 

 

0 Kudos
Message 18 of 18
(1,308 Views)