|
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.
|