![]() |
On Button press, run a sequence (Not momentary!)
As the title suggests, I'm trying to figure out how to run a sequence of events (Actuate solenoid, get reed switch value and when it's true, stop solenoid) on a button press. I've tried a structure, but I can't figure out how to run a sequence of events on a button press. This issue I'm running in to is that since a button press is momentary, the sequence begins to run, but when the button is released, the sequence stops.
Any ideas? Thanks so much! dwmcc |
Re: On Button press, run a sequence (Not momentary!)
The Flat Sequence structure is a natural for sequences of events. Each frame of the sequence will run in turn as the previous frame's functions complete. Put one in a neverending While in the Periodic Tasks vi, and make the first frame wait for the button press.
|
Re: On Button press, run a sequence (Not momentary!)
try something like this psuedocode, point being use an 'isActive' type boolean. If you're using labview, you'll have to look at this yourself, and find a similar concept (never used it)
bool solenoidRunning = false; //at init //following in main loop if (!solenoidRunning && buttonPressed){ solenoidRunning = true; activateSolenoid(); } else if (solenoidRunning && switchActivated) { stopSolenoid(); solenoidRunning = false; } Edit: Sorry, forgot to look at the forum category... |
Re: On Button press, run a sequence (Not momentary!)
Quote:
Thanks! dwmcc |
Re: On Button press, run a sequence (Not momentary!)
1 Attachment(s)
Try this.
|
Re: On Button press, run a sequence (Not momentary!)
Quote:
|
Re: On Button press, run a sequence (Not momentary!)
[quote=Alan Anderson;1129266]Try this
how can i program this to control a motor? |
Re: On Button press, run a sequence (Not momentary!)
[quote=gabrielc97;1130131]
Quote:
|
Re: On Button press, run a sequence (Not momentary!)
[quote=Pirate programe;1130143]
Quote:
|
| All times are GMT -5. The time now is 11:18. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi