Go to Post This is the best experience you will ever get. - Arefin Bari [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-03-2009, 21:44
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Timed Button

I'd suggest using a periodic loop for this. In the loop, check the button and wire to a switch. In the True case of the switch, turn on the motor, delay for the right amount of time, and set the motor speed to zero. Then return to scanning the button. To sequence the motor on/delay/motor off, you can use a dataflow dependency or a sequence structure.

As with the other periodic loop, put a delay in it to read the joystick at 50Hz or so.

Greg McKaskle
Reply With Quote
  #2   Spotlight this post!  
Unread 17-03-2009, 22:48
Luke Pike's Avatar
Luke Pike Luke Pike is offline
Programmer
FRC #1501 (THRUST)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Huntington
Posts: 114
Luke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to all
Re: Timed Button

In addition to what Greg said, you'll want to keep track of the last button value so you don't do it over and over again. To do this, use a shift register and wire in the button value. Use one of the Boolean operators to make sure you execute the code only when the button is true and the last button value is false.
__________________
Twitter Profile
Reply With Quote
  #3   Spotlight this post!  
Unread 17-03-2009, 23:16
assaf2b assaf2b is offline
Registered User
FRC #3075
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Israel
Posts: 17
assaf2b is a jewel in the roughassaf2b is a jewel in the roughassaf2b is a jewel in the rough
Re: Timed Button

Is there any chance to receive a screenshot on what you guys mean? I'm not sure if I'm doing it right... the result is that there's no delay, and that the switch keeps on moving only if the button is being held.
Reply With Quote
  #4   Spotlight this post!  
Unread 18-03-2009, 08:36
Luke Pike's Avatar
Luke Pike Luke Pike is offline
Programmer
FRC #1501 (THRUST)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Huntington
Posts: 114
Luke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to all
Re: Timed Button

I hope this isn't too late, but here it is. When I actually did it, Greg's way means you don't have to keep track of the last value because it doesn't matter, once the button is hit it delays for the right time and then returns, ready for another one.

I'm attaching both a screen shot and the vi. Hope it helps!
Attached Thumbnails
Click image for larger version

Name:	Timed Button.PNG
Views:	64
Size:	10.0 KB
ID:	7696  
Attached Files
File Type: vi Timed Button.vi (22.2 KB, 20 views)
__________________
Twitter Profile
Reply With Quote
  #5   Spotlight this post!  
Unread 18-03-2009, 17:06
assaf2b assaf2b is offline
Registered User
FRC #3075
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Israel
Posts: 17
assaf2b is a jewel in the roughassaf2b is a jewel in the roughassaf2b is a jewel in the rough
Re: Timed Button

Oh wow, that's gotta count for something. Thanks a lot guys.

We've passed the qualification rounds, and will surely need this mechanism for the finals. If it works properly, we will be forever in your debt.

Just please oh please tell me that it won't ruin our code, as we don't have enough time for drastic changes tomorrow.
Edit: Ok, backed the old one up and implemented yours, Luke. We'll have to see whether it works or not at the competition tomorrow.

Regardless of the result, we truly appreciate the time and effort you put into helping us.

Thanks,
#3075

Last edited by assaf2b : 18-03-2009 at 17:20.
Reply With Quote
  #6   Spotlight this post!  
Unread 18-03-2009, 19:16
Luke Pike's Avatar
Luke Pike Luke Pike is offline
Programmer
FRC #1501 (THRUST)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Huntington
Posts: 114
Luke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to all
Re: Timed Button

Thanks for the kind words, assaf2b. I would really hate for it not to work, so I quick tested it and found something that could be changed. I think if you use that code, it would keep the motor going until you released it, then wait and stop. I don't think this is the result you want, so I'm posting a revision of the code.

This time I took my own advice and stored the last button value and only took action when the button is true and the last value is false. Then when I ran it, it set the motor, waited the specified time, set the motor to zero, and didn't do it again until I released the button and pressed again. I think this is the behavior you want, so here is a screen shot and vi. Just drop the while loop into the Periodic Tasks vi, hook up the motor and joystick, and you should be good. I have tested this on the front panel and works as advertised there.

Great job on getting to the finals!
Attached Thumbnails
Click image for larger version

Name:	Timed Button.PNG
Views:	49
Size:	13.4 KB
ID:	7702  
Attached Files
File Type: vi Timed Button Test.vi (11.4 KB, 25 views)
__________________
Twitter Profile
Reply With Quote
  #7   Spotlight this post!  
Unread 19-03-2009, 16:34
assaf2b assaf2b is offline
Registered User
FRC #3075
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Israel
Posts: 17
assaf2b is a jewel in the roughassaf2b is a jewel in the roughassaf2b is a jewel in the rough
Re: Timed Button

Ah well, it didn't work. But hey, who cares, we're going to Atlanta! Rookie All-Star award, and 2nd place in our country's competition.

What I did was move the opening reference of the joystick from Teleop Init to the Begin VI, add it to the Periodic typedef, insert your code in the Periodic VI, and yet it didn't work - whenever the button was held, the motor kept going with it.

However, as I said, we'd all like to thank you regardless of the results.

HUGE thanks from team #3075, Israel!
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Button input? RyanCool435 Programming 3 31-01-2009 08:57
Capture webcamera images at timed intervals? NoodleKnight IT / Communications 7 12-09-2004 03:42
Button Making PureMachine4 Rumor Mill 58 16-04-2004 16:00
Triping Timed Fuses Joe Canavan Electrical 2 21-02-2002 09:34
Button Bar Adrian Wong CD Forum Support 8 04-06-2001 20:27


All times are GMT -5. The time now is 21:37.

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