View Single Post
  #14   Spotlight this post!  
Unread 23-01-2008, 00:06
Jim E Jim E is offline
Registered User
FRC #1523 (M.A.R.S.)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Lantana, FL
Posts: 188
Jim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond repute
Re: A New Programmer

Hi,

You can try this, but I don't make any guarantee.

Toggle_gripper(current state)
{
int temp_state;
If ((p3_sw_trig==TRUE)&&( current _state== CLOSED)
temp_state=current_state;

else if (p3_sw_trig==TRUE)
temp_state=OPEN;

else if ((p3_sw_trig==FALSE)&&(current_state==OPEN))
temp_state=current_state;

else if ((p3_sw_trig==FALSE)
temp_state=CLOSED;

} return (temp_state);

In you Default _Routine, simply call the function:


pwm_state=Toggle_Gripper(current_pwm);
if (current_pwm<>pwm_state)
pwm=pwm_state;

I'm writing this off the cuff, you will need to correct the syntax and apply your own values for the pwm assignments, but it looks plausable. Good luck.
__________________
Team MARS = 1.523 AU from the SUN!

Jim E.