View Single Post
  #4   Spotlight this post!  
Unread 05-02-2011, 00:03
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,563
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: turning a push button into a switch

Quote:
Originally Posted by WizenedEE View Post
I attached the code we made this year. To use it, just put it in a vi, connect up your momentary button and "switched" output, and then make a shift register and wire that up to the top. The shift register is outside the vi so we can use the same vi many times (if it were inside, the shift register would maintain its values from call to call, not just from loop to loop.)

My vi works fine in teleop; there's a 20ms loop in teleop and your code has a 10ms loop; it's not a big difference. The 20ms actually helps debounce the switch for us.

NOTE: This code is untested in the real world - you might have to do something to debounce switches. I did test it in the vi with the front panel controls though.
You can put shift registers or feedback nodes inside the VI if you set it to be reentrant in the VI properties.

Here's how my team does it: http://forums.usfirst.org/showthread.php?t=10544
Reply With Quote