05-12-2016 10:56 AM
Hi, I want to use a boolean push button (switch until released) in order to count to a specific value and when getting this value (while continually pushing the button) to turn on a led. If I release this boolean button I want it to count the time up to a specific value and then to turn off the light, like a hand detection for a hand dryer.
I was thinking to use the tick count in a flat sequence with a delay for the specific time I want and to devide it to a true/false case but the problem is that the count of the tick count is continuous and not stoping at the specific value I want for the truning on/off the led.
Any help?
TNX
Guy
Solved! Go to Solution.
05-12-2016 12:26 PM
you could not use switch until released for this one as I know maybe this vi could be helpful for you
05-12-2016 01:52 PM - edited 05-12-2016 01:52 PM
The Elapsed Time express VI seems to do the job here. Just reset the time whenever the button value changes.
05-12-2016 03:09 PM
I will try that but I suppose to do it with tick count.
TNX
05-12-2016 03:10 PM
the file you attached is not working due to some error.
TNX
Guy
05-12-2016 03:24 PM - edited 05-12-2016 03:30 PM
and can you please explain why do I need the registers?
Didn't get the green square befor the "not equal" icon, if you can explain this too or attach your Vi.
Tnx a lot
05-12-2016 03:49 PM
OK , I got a Vi that does almost what I need (attached). I need that if the user give a specific values for timeout1 and timeout2 than the count will run to that number and than will stop and will not continue from the begining so that the led will not blink on and off.SEcond thing , when releasing the button if the led is on I need a count to timeout 2 an at the end of it to turn the led off.
Anyone?
05-12-2016 04:20 PM
Sorry, I don't understand all your requirements, but I would highly recommend to use an event structure. For a switch until release you get two event, once when pressed and one when release and you even get the tick count for free. No need for all that extra convoluted stuff.
Here is a very simple example that displays the time since the down-press and then displays the final time on the release. Modify as needed.
See if this can give you some ideas.....
05-12-2016 04:32 PM
Hi, I need the button to be a detector of auto tap or auto hand dryer. after detection of timeout1 iwant it to turn the led on, when releasing the button timeout2 is running and when getting to timeout2 the led turns off ( the led is the tap or hand dryer). In the prgram you gave the led blinks.Tnx anyway 🙂
05-12-2016 04:46 PM
@GuyGor wrote:In the prgram you gave the led blinks.Tnx anyway 🙂
As I said, my code is only a starting point skeleton. Notice the "modify as needed".
Should be trivial to adapt to your needs....