View Single Post
  #3   Spotlight this post!  
Unread 16-04-2005, 15:40
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
Re: LED drivers on OI

The 11 leds you see on your OI box can be controlled (in order) by the following variables from code:

Pwm1_red, Pwm1_green, Pwm2_red, Pwm2_green
Relay1_red, Relay1_green, Relay2_red, Relay2_green
Switch1_LED, Switch2_LED, Switch3_LED

Set any of these variables to true (that is, a non-zero integer, normally 1) to light them up, and false (0) to turn them off. I have in my code "Pwm1_green = (filter == PWMC_LINEAR);" for example, where filter is a variable and PWMC_LINEAR is a constant, but you could just as easily (and less cryptically) do "if(filter == PWMC_LINEAR) Pwm1_green = 1; else Pwm1_green = 0;".

Two of the joystick ports (1 and 3) have the so called "Led Drivers" that allow you to connect your own leds (I believe between the driver pin and +5, but check the OI pdf to make sure and also to check the proper current level). The other two (2 and 4) provide access to the same buttons that are on the two first two, in addition to their own buttons.

This hasn't proven very useful to my team, however. For some reason, the led drivers are controlled by the exact same variables that control the normal leds embedded on the OI, making them totally redundant. You're better off just using the OI leds and not worrying about making an adapter for the port.

By the way, the led data is sent to the OI on the same byte as the User_Mode_byte, so the leds will only display if your OI is not set in user mode (just toggle the button to battery power or something).

Hope this helped.