View Single Post
  #12   Spotlight this post!  
Unread 05-03-2007, 00:01
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: PROGRAMMING PNEUMATICS

If you need an edge trigger rather than level trigger, do something like this - assuming that variable 'buttons' holds the state of the joystick(s) buttons, and 'old_buttons' keeps track of the previous state of the buttons:

Code:
  if(buttons!=old_buttons)
  {
    if((buttons&0x1)==0)      /* example - bit 0 is the button to react to */
    {
      do_something_here();    /* execute once per button push */
    }
  }
  old_buttons=buttons;