Light programming

Hi,
We just got the light and I hooked it on to a relay. It workd fine. I hooked it on to relay 3, which is assigned to p3_sw_trig and p3_sw_top, but we have a little problem.

The light is on untill I keep pressing the button, but I wanna do something else. I want to hit the top button once on joystick3 and have the light turn on. I mean I should have to hold down the button to keep the light running. And when I wanna turn the light off, I should be able to do it by hitting the trigger button once on joystick3.

Can anyone tell me the exact code I can insert to do this. I need it urgently.

Thanx

You want to use the joystick trigger or thumb button to toggle a relay on and off, if I read this correctly.

This thread has information on doing that which was very helpful to me, so it should help you.

Keep in mind that in your actual final robot, the light has to turn on and off automatically. The easiest way to do this is to write a line of code that sets one relay to be always on in forward, and hook the light to that relay. The safety feature of the Master CPU that disables all outputs when the disable signal is sent from the Arena controller, or when no signal is recieved from the OI, will take care of the rest…

When using the default code, you have to plug in the relay to relay output 8. It will now turn on when the robot does. I think that this is required by FIRST to have it like this.

Also remember that it has to turn in a certain direction…

I was able to keep the light on when the CPU turned on on, and turn if off when the CPU turned off. I thought we had to have the capability of tuning it on and off, but as u guys say. Have u guys toggled ur lights or just make it turn on and off with the master CPU

Per somewhere in the rules:
“the light must be connected in such a way that it turns on when the robot is enabled and off when it is disabled”…read: automatic(no toggle switches for the light, as much as we’d like them to save power)

Rule 2.1.2 Rotating Light, and rule c26 state basically what Nate said.

Rule M8 also covers aspects of the light (mounting to be visible, &c).

Although I couldn’t find the place where it is stated, I’m sure teams will leave the light on all through the match, so as not to distract the officials.

AWiser wrote:

> Also remember that [the rotating light] has to turn in a certain direction…

Huh??? Is there such a rule??? Please state the rule number that says that it has to turn in a certain direction.

Please correct me if I’m wrong, but as far as I can see, the rules only state that you have to have it running SOME way any time the robot is enabled. After all, it is just a warning light. The direction doesn’t matter for that usage.

  • Section 2.1.2 only states that which color wires go where on the spike.
  • M8 only talks about its visibility.
  • C26 talks about it being driven by a relay module (spike) & it’s to be auto ENABLED whenever the robot is running and off otherwise.

Our rotating light is simply a motor and a light bulb. It doesn’t care about polarity. Now if your light has a semiconductor module inside running it, that WOULD be a different story (but even then I see nothing that says you couldn’t swap the two motor leads inside it for grins to make it run the other way :-).

  • Keith McClary, Advisor, Huron High Team 830 “Rat Pack”

Section 2.1.2 Rotating Light gives explicit details on wiring up the light. I think polarity does matter. The drive system on the light likes to work in one direction and not the other.

Also, we got scolded for not using relay 8 forward to power the light. From what I could gather, it has to do with disabling the robot remotely during the competition.

You can put the light on any relay, but you need to set that relay to always be in foreward. When the robot is disabled, all the outputs are disconnected by the master processor, so the light turns off. The judges probably dont want you to have direct control of the light for safety reasons. If you want to cut off the light for testing, just unplug the data cable to the relay. Just remember to plug it back in before you go to a match.

The rule on rotation actually comes from the wiring more than the light itself. You have to use specific color-coded wire to connect the light. The rotation was more of an issue 2 years ago when we only had the one lead on the light. Now that it is a two wire set-up just hook up the two wires correctly and you will be all set.

Thanx u all

I wasn’t aware of the rule about the light always being on. I thought it might be like last year, when we had our light toggle. But thanx anyway to u all:)

Not true…

Yes, the light does serve as a warning. However, the biggest reason for having such a large light with colored lenses is so that the spectators can determine which robots are on which team.

In the first year of the “alliances”, even the operators had a hard time remembering who was on your team and who was opposing you.

As far as the technical question is concerned, simply hook up the spike to relay 8 and wire the light red(+) and black(-) and move on… You should have bigger issues to worry about.

Everyone is still missing the point of my question.

Yes, the light HAS to ALWAYS be on whenever the robot is enabled.

Yes, you must wire the red to M+, black to M-, etc…

Yes, you must wire it to a spike, and command it to simply turn on in the loop, and NOT turn it off anywhere in your code.

Doing it this way insures that it acts properly WRT the game. Since you have to keep hitting a spike with an ON command of SOME kind to keep it running or it shuts itself off, simply hitting with an ON command of one kind each loop has the SIDE EFFECT of autoenabling of the light whenever the robot is on, and turning it when the robot is disabled (very cute… :-).

However, no one has still shown me a RULE that states the SPIN DIRECTION of the rotating light matters. If for example you followed ALL the wiring rules and simply placed a “reverse” statement at the top of the loop instead of “forward”, it would follow ALL the design rules and look and behave JUST the same EXCEPT for turning the other way around while on. No big deal, and I don’t see ANY place where it says that is illegal.

BTW, there IS a reason why I ask <grin>, but unfortunately with our latest design change makes answer moot and more for curiosity for future possibilities than anything else.

If someone sees ANYWHERE in the rules (or in a ruling) that says the light MUST rotate THIS PARTICULAR WAY, please quote the rule.

Thanks!

  • Keith McClary, Advisor, Huron High Team 830 “Rat Pack”

well, i think it’s more of the fact that the light doesn’t turn the other way. i’m not completely sure, but i remember reading that somewhere here.

Well, OUR light turns just FINE in either direction. <grin> Same speed, brightness, noise, etc…

Remember, unless you’ve been given something REALLY strange (and different from what WE were shipped), gumball lights are simply a 12V light bulb, and a 12V motor on a gear train, wired in parallel.

The red and black wires are simply a construction convenience so that if you wire them the same polarity, they rotate the same way. There’s nothing “magical” about it, nor any mythical “mechanical or electrical preference” WRT it turning in either direction.

  • Keith McClary, Advisor, Huron High Team 830 “Rat Pack”

    “News Flash: Zeus joins Intel and becomes a Myth Coprocessor…”