Thread: Timed Button
View Single Post
  #7   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:	48
Size:	13.4 KB
ID:	7702  
Attached Files
File Type: vi Timed Button Test.vi (11.4 KB, 24 views)
__________________
Twitter Profile
Reply With Quote