#include "Main.h" void OperatorControl ( void ) { unsigned char joystick_1; unsigned char joystick_2; int rampspeed1; int rampspeed2; while ( 1==1 ) { joystick_1 = GetOIAInput ( 1 , 2 ) ; joystick_2 = GetOIAInput ( 2 , 2 ) ; if ( joystick_1>130&&joystick_2>130 ) { rampspeed1=127 ; rampspeed2=127 ; while ( joystick_1!=rampspeed1&&joystick_2!=rampspeed2 ) { SetPWM ( 1 , rampspeed1 ) ; SetPWM ( 2 , rampspeed2 ) ; rampspeed1 ++ ; rampspeed2 ++ ; } } else if ( joystick_1<123&&joystick_2<130 ) { rampspeed1=127 ; rampspeed2=127 ; while ( joystick_1!=rampspeed1&&joystick_2!=rampspeed2 ) { SetPWM ( 1 , rampspeed1 ) ; SetPWM ( 2 , rampspeed2 ) ; rampspeed1 -- ; rampspeed2 -- ; } } else if ( joystick_1==rampspeed1&&joystick_2==rampspeed2 ) { SetPWM ( 1 , joystick_1 ) ; SetPWM ( 2 , joystick_2 ) ; } else if ( joystick_1>130&&joystick_2<123 ) { SetPWM ( 1 , joystick_1 ) ; SetPWM ( 2 , joystick_2 ) ; } else if ( joystick_1<123&&joystick_2>130 ) { SetPWM ( 1 , joystick_1 ) ; SetPWM ( 2 , joystick_2 ) ; } else if ( joystick_1>130 ) { rampspeed1 = 127 ; while ( joystick_1!=rampspeed1 ) { SetPWM ( 1 , rampspeed1 ) ; rampspeed1 ++ ; } } else if ( joystick_2>130 ) { rampspeed2 = 127 ; while ( joystick_2!=rampspeed2 ) { SetPWM ( 2 , rampspeed2 ) ; rampspeed2 ++ ; } } else if ( joystick_1<123 ) { rampspeed1 = 127 ; while ( joystick_1!=rampspeed1 ) { SetPWM ( 1 , rampspeed1 ) ; rampspeed1 -- ; } } else if ( joystick_2<123 ) { rampspeed2 = 127 ; while ( joystick_2!=rampspeed2 ) { SetPWM ( 2 , rampspeed2 ) ; rampspeed2 -- ; } } else if ( joystick_1==rampspeed1 ) { SetPWM ( 1 , joystick_1 ) ; } else if ( joystick_2==rampspeed2 ) { SetPWM ( 2 , joystick_2 ) ; } else { SetPWM ( 1 , 127 ) ; SetPWM ( 1 , 127 ) ; } } }