|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||||
|
|||||
|
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.
|
|
#3
|
|||
|
|||
|
Re: On Button press, run a sequence (Not momentary!)
Quote:
Thanks! dwmcc |
|
#4
|
|||||
|
|||||
|
Re: On Button press, run a sequence (Not momentary!)
Try this.
|
|
#5
|
|||
|
|||
|
Re: On Button press, run a sequence (Not momentary!)
|
|
#6
|
||||
|
||||
|
Re: On Button press, run a sequence (Not momentary!)
[quote=Alan Anderson;1129266]Try this
how can i program this to control a motor? |
|
#7
|
||||
|
||||
|
Re: On Button press, run a sequence (Not momentary!)
[quote=gabrielc97;1130131]Change the DIO VIs to MotorControl VIs, with parameters controlling it as you need to?
|
|
#8
|
||||
|
||||
|
Re: On Button press, run a sequence (Not momentary!)
[quote=Pirate programe;1130143]Thanks! we'll try that.
|
|
#9
|
||||
|
||||
|
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... Last edited by compboy07 : 16-02-2012 at 23:46. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|