Thread: OI LEDs
View Single Post
  #1   Spotlight this post!  
Unread 12-02-2008, 16:50
B_Dubbs B_Dubbs is offline
Registered User
AKA: Brian
FRC #1153
Team Role: Programmer
 
Join Date: Mar 2007
Rookie Year: 2006
Location: Walpole, MA
Posts: 29
B_Dubbs is an unknown quantity at this point
OI LEDs

Hi, team 1153 has been trying to get our OI LEDs, Pwm1_green, Pwm1_red, Relay1_green etc., to work when a button is pressed.

We have tried many various solutions but the only lights we could get to work properly in Manual mode was the Switch LEDS. The only light we get on in Manual is Pwm1_green and whenever the aux1 button is pressed on the Port 1 joystick will it change and it changes in a type of bianary going from green to red to green and red to pwm2_green and etc in that order. We have a feeling that the code causing the OI to work under that system is interferring with our code but we couldn't find it anywhere in the code. If you could please help us get the Red LEDs to work, it would be greatly appreciated. Here is our code in question if it will help:

Code:
   if      (p4_sw_trig == 1)  {ElevW= 0; DesiredHeight=   0; }  //Lowest
   else if (p4_sw_top  == 1)  {ElevW= 1; DesiredHeight=  20; }  //Medium
   else if (p4_sw_aux1 == 1)  {ElevW= 2; DesiredHeight=  50; }  //High
   else if (p4_sw_aux2 == 1)  {ElevW= 3; DesiredHeight= 100; }  //Very High

      if (ElevW == 0)
      { 
          //printf("ELEVW=0\n\r");
          Pwm1_red = 1;           //Pwm1_red LED is on
          Pwm1_green= Pwm2_green= Pwm2_red= Relay1_green= 0; // LEDs off
          Relay1_red= Relay2_green= Relay2_red= 0; //LEDs off	
      }
      else if (ElevW == 1)
      {
          //printf("ELEVW=1\n\r"); 
          Pwm2_red  = 1;          //Pwm2_red LED is on
          Pwm1_green= Pwm1_red= Pwm2_green= Relay1_green= 0; // LEDs off
          Relay1_red= Relay2_green= Relay2_red= 0; //LEDs off	
      }
      else if (ElevW == 2)
      { 
          //printf("ELEVW=2\n\r");
          Relay1_red  = 1;  // Relay1_red LED is on
          Pwm1_green= Pwm1_red= Pwm2_green= Pwm2_red= 0;  //LEDs off
          Relay1_green= Relay2_green= Relay2_red= 0;   //LEDS off	
      }
      else if (ElevW == 3)
      {
          //printf("ELEVW=3\n\r");
          Relay2_red  = 1;  //Relay2_red LED is on
          Pwm1_green= Pwm1_red= Pwm2_green= Pwm2_red= 0; //LEDs off
          Relay1_green= Relay1_red= Relay2_green= 0;	 //LEDs off
      }
By using the printfs we are sure the code is working as it prints out the numbers and if we switch the LEDs to the Switch LEDs they will change also. Any help is greatly appreciated.