View Single Post
  #4   Spotlight this post!  
Unread 28-01-2009, 22:29
AndrewN's Avatar
AndrewN AndrewN is offline
it's alive!
AKA: Andrew Nicholson
FRC #1778 (Chill Out)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Edmonds, WA
Posts: 48
AndrewN is just really niceAndrewN is just really niceAndrewN is just really niceAndrewN is just really niceAndrewN is just really nice
Re: How do I program a relay to turn on and off by pressing a button on the joystick?

Try something like this example in the Basic Framework:

http://www.chiefdelphi.com/forums/at...d=123319909 8

The "Off", "Forward", "Reverse" are constants created from the input to the relay "Set" VI.

The Up/Down arrows on the while loop are "Shift Registers" created using the menu on the while loop border. These are used to contain the current setting of the relay.

The T/F selectors are on the Programming Comparison Palette. These allow you to select the old value or the new one based off the buttons.

The buttons are obtained using the cluster "unbundle by name" function.
There is no button to turn the relay off ... you'll have to extend the example.

Don't forget the other cases in the main loop. The example is not complete.
Attached Thumbnails
Click image for larger version

Name:	TwoButtonRelay.gif
Views:	256
Size:	9.1 KB
ID:	7256  
__________________
Andrew Nicholson
2011 FRC Robot Inspector (Seattle, Portland)
Mentor FRC 1778 "Chill Out", FTC 3018, 3940 "Hawks", 4434 "Heat Misers"

"Everything should be made as simple as possible, but no simpler."
Reply With Quote