View Single Post
  #5   Spotlight this post!  
Unread 25-02-2007, 01:04
dpick1055's Avatar
dpick1055 dpick1055 is offline
David Pick
FRC #1739 (Chicago Knights)
Team Role: Alumni
 
Join Date: May 2005
Rookie Year: 2004
Location: Chicago
Posts: 75
dpick1055 is on a distinguished road
Send a message via AIM to dpick1055
Re: PROGRAMMING PNEUMATICS

It's actually fairly simple to have the trigger control an action with the pneumatics. What have you to do is declare some variable like handstate.

Then when your trigger is pressed changed the value of handstate to 1 or 0. Then when the trigger is pressed you know whether your hand is opened or closed and you can do an action based on it.
Code:
int handstate;
handstate = 0; //default position for whatever your using

if (p1_sw_trig == 1 && handstate == 0)
{
relay2_fwd = 1;
handstate = 1;
}
if (p1_sw_trig == 1 && handstate == 1)
{
relay2_rev = 1;
handstate = 0;
}
__________________
Always remember to take your powered wheels off the ground when first testing code. Otherwise you'll end up with holes in the wall like us

Last edited by dpick1055 : 25-02-2007 at 01:09.