View Single Post
  #3   Spotlight this post!  
Unread 16-02-2012, 23:03
compboy07's Avatar
compboy07 compboy07 is offline
Registered User
AKA: Jake M.
FRC #2449 (Out of Orbit)
Team Role: Electrical
 
Join Date: Feb 2012
Rookie Year: 2011
Location: Tempe, AZ
Posts: 19
compboy07 is on a distinguished road
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.
Reply With Quote