View Single Post
  #1   Spotlight this post!  
Unread 10-04-2013, 13:51
wre136's Avatar
wre136 wre136 is offline
Registered User
AKA: Will Edds
FRC #2461 (The METAL-SKINS)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Oklahoma City
Posts: 30
wre136 is an unknown quantity at this point
Make Robot Glow with Alliance Colors Automatically

If you are interested in making your robot glow the color of you alliance using LED lights, you can program it to choose a color automatically depending on which alliance you are on.

To start, add two relays to the robot. Wire one relay to control the red LEDs and the other relay to control the blue LEDs. Open the relays in the Begin VI and close them in the finish VI.

Create a new blank VI. Insert the "Get Alliance" VI from WPI Robotics Library -> Driver Station -> Get Alliance.VI

Place a Case structure in the block diagram and wire the Alliance Output terminal from the "Get Alliance" VI to the case selector icon.

Next add references for the two relays that control the LEDs to the VI. Wire them to Relay Set VIs. As for setting them, create a constant from one of the set VIs and move it into the Red case of the case structure and create a copy of it so there are two of these constants inside of the red case. Set one to on and the other to off. Wire the on constant to the Red Light Relay and the off to the Blue Light Relay.

Repeat the above for the blue case but make the appropriate switch for the values.

Lastly for the invalid case, wire an off to both terminals so that no lights will be on if no alliance is found.

Save the VI with a name you like. To use this VI, simply drag and drop it into a loop in periodical tasks and BOOM! There you go. Now even if you change your alliance using the driver station, your color should change with it. Enjoy ;-)
Attached Thumbnails
Click image for larger version

Name:	Alliance Color Code.PNG
Views:	166
Size:	7.7 KB
ID:	14565