View Single Post
  #2   Spotlight this post!  
Unread 01-02-2007, 21:04
Nathan's Avatar
Nathan Nathan is offline
Registered User
FRC #1501 (Team T.H.R.U.S.T.)
Team Role: Alumni
 
Join Date: Sep 2006
Rookie Year: 2007
Location: United States
Posts: 149
Nathan has a spectacular aura aboutNathan has a spectacular aura aboutNathan has a spectacular aura about
Re: making a trigger a toggle

Hi, I'll post below what I'm using right now... As a sidenote, I have two variables you'll need. One is name "port1_trigger" and the other "Lift."


Code:
void Lift_Control ( void )
{
      if ( port1_trigger == 1 ) // If the trigger was pressed last.
      {
            Last_Button_Pressed = 1 ; // Then the trigger was pressed last.
      }
      if ( port1_thumb == 1 )
      { // If the thumb button was pressed last.
            Last_Button_Pressed = 2 ; // Then the thumb button was pressed last.
      }
      if ( Last_Button_Pressed == 1 ) // If the last button pressed was the trigger, then....
      {
            Lift = 1  ; // Lift the platform!
      }
      else
      {
            Lift = 0 ; // Don't lift the platform.
      }
      SetRelay ( 1 , Lift , -1 ) ; // The spike relay will have the value of the variable "Lift."
}
I hope that helps
-Nathan