LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop running after spending 20 seconds

Hello guys

I'm trying to develop an alarm system for a house. As you can see in the attachment I did the alarm system with 3 code attempts but also liked to implement beyond the 3 attempts, wanted to put 20 seconds as time limit to be able to insert the code, after spending that time just wanted to run finished.
Thank you

 

 

Download All
0 Kudos
Message 1 of 5
(2,318 Views)

You need a WHILE loop instead of a FOR loop.

 


@jpeyroteo wrote:

As you can see in the attachment I did the alarm system with 3 code attempts but also liked to implement beyond the 3 attempts, wanted to put 20 seconds as time limit to be able to insert the code, after spending that time just wanted to run finished.


It is a really bad idea to stop an alarm system after a certain time, because then it no longer protects your house. I guess you want to give an alarm in no valid disarm code is entered during a certain time frame.

0 Kudos
Message 2 of 5
(2,306 Views)

Also, please do a few basic tutorials, because most of your ode is extremely convoluted. Your inner FOR loop does not make a lot of sense. What is it supposed to do? You can compare the two arrays directly. The "equal TRUE" part can be deleted without any change in functionality, it just returns the original input.

 

Look into state machine architecture. There are plenty of examples and design templates.

0 Kudos
Message 3 of 5
(2,302 Views)

@altenbach  escreveu:

Also, please do a few basic tutorials, because most of your ode is extremely convoluted. Your inner FOR loop does not make a lot of sense. What is it supposed to do? You can compare the two arrays directly. The "equal TRUE" part can be deleted without any change in functionality, it just returns the original input.

 

Look into state machine architecture. There are plenty of examples and design templates.


I know this but this is project for the school and teacher asked besides the 3 wrong codes, either a time limit of 20 seconds, that is, if you put the 3 wrong codes to stop the program or if you spend the 20 seconds the program stops .

0 Kudos
Message 4 of 5
(2,286 Views)

I assume you tried to solve this. Where did you get stuck?

Did you learn about the various timing functions in class?

 

You need to have at least two shift registers: One to increment the count for each wrong entry and one to store the relative start time reference so you can know when 20 seconds are up. Go over your class notes and read the section about shift registers again. It should all fall in place easily. 😉

0 Kudos
Message 5 of 5
(2,281 Views)