LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

variable increase for each loop iteration

Hi all!!

 

I am currently taking a class over Labview, and I am running into a problem with one of my assignments. Now, before you write me off because this is homework, my teacher told all of us that he does not care how we get the solution as long as we understand it. He said to help each other, google it, find other peoples code and use it. So he's fine with it and he would probably explain it to me, but eveyone has a lot of questions during class time so I don't have the ability to ask him. 

 

Now that all of that is out of the way, I'll explain what my problem is. I am coding a secure user login. I am using a state machine, where a user inputs data, presses a button labeled enter, then the data is matched against pre-existing user login information to see if it matches. If it does, then a green LED lights up and all is good. If not, then a red one does and an error message displays for them to try again. Now, the problem I'm having is at this next part, after 3 failed attempts the user is locked out and an admin password has to be put in. My problem is that I can't figure out how to store an incremented value in order for it to know when to stop. I have uploaded my code so if anyone can look at it and give me some advice that would be great! Thanks! I have scoured the internet for this and I can't seem to find a solution that works for what I'm doing. 

0 Kudos
Message 1 of 7
(3,273 Views)

"Shift Register"

0 Kudos
Message 2 of 7
(3,254 Views)

Your mistake is in allowing your shift register to "Use Default if Unwired".  Any state that is not "5" will pass a 0 through to the next loop iteration. In cases like this, take a look at the linked input tunnel.

 

Also purely style:  The benefit of using enumerators in a state machine is so that you aren't forced to use enigmatic names.  Give them some meaning!

 

Edit:  I looked through your code a bit more.  Here are some additional comments.

 

1.  You need to be far more careful about "Use Default if Unwired" option.  You have almost every output tunnel set to that mode which is, as a general rule, not a good idea.  

 

2. In your "State 0" you have a while loop that is just polling the "Enter" boolean as fast as it can.  You should consider using an Event Structure there instead.  If you have not learned them yet, at least put a delay in that loop so that it doesn't hog 100% of a processor core doing nothing.

 

3. You are already getting in the habit of overuse of local variables.  Don't.  An example is your "FAILED ATTEMPTS"... the indicator is just sitting in your state "3" and you are wiring the output in to a local variable.

Message 3 of 7
(3,241 Views)

Since this is homework.... AND your professor does not mind where you get it rather than if you understand it.  (I Actually LIKE that!)

 

Just use LabVIEW to access the Windows Active Directories through the .NET code already in-place.  (Trust me-- I had to do this once for a client so that the operators enterprise login could link to the training records and assure everyone operating a station was qualified to do so):smileywink:

 

A Few Google searches and get that A+

 

 

OR, In other words--- that round thing is called a "Wheel" the principles are the same if you use it or re-invent it.  Either way it works exactly the same.  Apparently, your instructor feels that it is more important to know how it works than how to build it.  I'm good with that! give your instructor my regaurds!


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 7
(3,211 Views)

@JÞB wrote:

 

Just use LabVIEW to access the Windows Active Directories through the .NET code already in-place.

 


Telling a newbie to mess around with Windows API with .NET may be... overwhelming 😛

 

Regardless, here:

domain login.png

Message 5 of 7
(3,194 Views)

@BowenM wrote:

@JÞB wrote:

 

Just use LabVIEW to access the Windows Active Directories through the .NET code already in-place.

 


Telling a newbie to mess around with Windows API with .NET may be... overwhelming 😛

 

Regardless, here:

 


Telling a student that it is OK to learn can be rewarding!  Thanks for the example-  There are a few out there but my google-fu failed me.


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 7
(3,185 Views)

Thank you! I appreciate all of the feedback, I will definitely look into all of the suggestions you gave me!

0 Kudos
Message 7 of 7
(3,163 Views)