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 :wink:

Alliance Color Code.PNG


Alliance Color Code.PNG

This would be so much cooler than changing bumpers.

It’s also possible to do this with a single Spike relay instead of two… Simply wire the LED’s backwards of each other - for example, red gets its + wire to M+, and its - wire to M-, while blue gets its + wire to M-, and its - wire to M+. Put the spike in forward, one will light up. Put it in reverse and the other will light up. For the default/invalid state, turn it off.

This works because LED’s are, above all else, a diode - they only conduct electricity (well, in an ideal world… in the real world there is some leakage) in one direction, and not the other. Thus, when powered “backwards”, an LED won’t light up!

Imagine a white light diffuser pool noodle cover with different colored LEDs behind them. That would be kinda cool. Not sure how team numbers would work. Maybe shadows on the inside of the diffuser.

I would think to white LEDs in the shape of the team number on the inside of the pool noodle would work, but is that legal? Cool if it was!

Is there something like Get Alliance in C++ as well?

Yeah, there is, something like that:

DriverStation.GetInstance->GetAlliance()

Even though the syntax may be wrong, I’m a little rusty with C++…

We did this on team 308 in 1999 (the first year of alliances). We had a 6" x 12" grid of LEDs on each side of the robot that we could switch from red to blue. That was the only year we did it, but it looked great.

There is. In C++ see DriverStation::GetAlliance(). In Java it’s DriverStation.getAlliance()

One of our students developed something similar this year with SPI bus driven tri-color LED strips running under Arduino control.

  • During the initial disabled period before the match the LED strips show a slowly chaning rainbow pattern
  • During autonomous the alliance color would flash along the LED strips
  • In teleop we would use each side as a bargraph to display the wheel encoder readings for each side of tank drive
  • On successful climb & dump the driver operates a switch and the LEDs show the team’s “tie dye” colors in a flashing pattern
  • We had a few other modes programmed but didn’t use them in matches
  • 4 DIO pins were used to communicate “mode” and 2 PWM to transmit “analog” values from the cRIO to the Arduino

Definitely the prettiest robot I’ve been associated with.

Not currently (or any time in the foreseeable future), but one can hope!