Go to Post That'll teach me to send anyone for a tool. - Rich Kressly [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 16-02-2012, 22:28
dwmcc dwmcc is offline
Registered User
FRC #2192 (YAK Attack)
Team Role: Leadership
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Newport, Oregon
Posts: 14
dwmcc is an unknown quantity at this point
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
Reply With Quote
  #2   Spotlight this post!  
Unread 16-02-2012, 23:01
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 17-02-2012, 18:56
dwmcc dwmcc is offline
Registered User
FRC #2192 (YAK Attack)
Team Role: Leadership
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Newport, Oregon
Posts: 14
dwmcc is an unknown quantity at this point
Re: On Button press, run a sequence (Not momentary!)

Quote:
Originally Posted by Alan Anderson View Post
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.
Thank you both for your reply. Alan, I have inserted my code into the Periodic Tasks vi in a neverending while loop, but how can I tell it to run it when I press the joystick button?

Thanks!
dwmcc
Reply With Quote
  #4   Spotlight this post!  
Unread 18-02-2012, 00:33
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: On Button press, run a sequence (Not momentary!)

Try this.
Attached Thumbnails
Click image for larger version

Name:	solenoid sequence.png
Views:	85
Size:	54.3 KB
ID:	11962  
Reply With Quote
  #5   Spotlight this post!  
Unread 18-02-2012, 14:21
dwmcc dwmcc is offline
Registered User
FRC #2192 (YAK Attack)
Team Role: Leadership
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Newport, Oregon
Posts: 14
dwmcc is an unknown quantity at this point
Re: On Button press, run a sequence (Not momentary!)

Quote:
Originally Posted by Alan Anderson View Post
Try this.
Thank you so much! Worked perfectly.
Reply With Quote
  #6   Spotlight this post!  
Unread 19-02-2012, 12:27
gabrielc97's Avatar
gabrielc97 gabrielc97 is offline
Registered User
AKA: Gabriel
FRC #4029 (Spartan Bots)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Huntington Park CA
Posts: 39
gabrielc97 is an unknown quantity at this point
Re: On Button press, run a sequence (Not momentary!)

[quote=Alan Anderson;1129266]Try this


how can i program this to control a motor?
__________________
Gabriel
Reply With Quote
  #7   Spotlight this post!  
Unread 19-02-2012, 12:52
Pirate programe's Avatar
Pirate programe Pirate programe is offline
Registered User
FRC #0354
 
Join Date: Jan 2012
Location: Queens,NY
Posts: 53
Pirate programe is an unknown quantity at this point
Re: On Button press, run a sequence (Not momentary!)

[quote=gabrielc97;1130131]
Quote:
Originally Posted by Alan Anderson View Post
Try this


how can i program this to control a motor?
Change the DIO VIs to MotorControl VIs, with parameters controlling it as you need to?
Reply With Quote
  #8   Spotlight this post!  
Unread 19-02-2012, 13:03
gabrielc97's Avatar
gabrielc97 gabrielc97 is offline
Registered User
AKA: Gabriel
FRC #4029 (Spartan Bots)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Huntington Park CA
Posts: 39
gabrielc97 is an unknown quantity at this point
Re: On Button press, run a sequence (Not momentary!)

[quote=Pirate programe;1130143]
Quote:
Originally Posted by gabrielc97 View Post

Change the DIO VIs to MotorControl VIs, with parameters controlling it as you need to?
Thanks! we'll try that.
__________________
Gabriel
Reply With Quote
  #9   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
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:43.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi