01-22-2012 06:24 AM
Hi
In my program I have to use a start button to continuously average a value for a certain amount of time(lets say 3s) and keep and show the average the value. The state of the start button should return to off mode after that 3 sec so if the user hit the start button again it reset the array and calculate the average again.
Would you please help me with this program. I have attached pic of what I ahev done
With this vi I can take data after hitting start for 3 sec but I have these problems:
1- I don't know how to calculate average value when finish getting data after 3 sec
2- I would like the start button back to off mode after 3 sec so if I click on the start button again it reset the array and calculate the average again.
Would u plz help me with this vi?
01-22-2012 10:19 PM
Use mean function to average an array. And wire your time has elapsed boolean to a case structure and reinitialise your boolean control to default in the true case.
Create invoke node as below, just in case you dont know.
02-02-2012 07:52 AM
Hi aCe, many thanks for your reply. I have tried your methods but I still have few problem. The problem I have now is when I click on the boolean control I can store data in a data array and I calculate the average also when the time has elapsed reinitialise method can change the boolean to defualt value
but the problem I have now is what should I do if I want to do the measurement for a specific period of time again. Whit this design I can take the average just one time because and if I want to do it again I need to stop and run the program again. while I would like to take measuremant and take average everytime I hit the boolean control.
I need to also mention the automatic reset is not checked in this vi. Would u plz help me how can I change this vi to the continious averaging for me?
I have attached that part of my vi to this post
02-07-2012 08:29 AM
Hi en99
I may have misunderstood what you are asking but it sounds like you want your current code to run continuously until you stop it, am I correct?
If that's the case then you could just put a while loop around all your current code, with a stop button linked to the conditional terminal.
Please correct me if I've completely misunderstood your problem.