Ramping in easyC PRO

Hi, is there a way to work a ramp up/down code into the operator control mode code? If so, please post an example. (in easyC Pro) Thanks!

Try this, I didn’t test it but it works in my head :).


void main ( void )
{
      int rx1; 
      float output = 0; 

      while ( 1 ) // loop forever
      {
            rx1 = GetRxInput ( 1 , 1 ) ; // get RX Data
            rx1 -= 127 ; // Subtract 127 to make Neutral 0
            if ( rx1 > 10 && rx1 < -10 ) // Make a deadband on the joystick
            {
                  output += (float)rx1 / 100 // add .01 of joystick result to output
            }
            else // if in deadband reset output to 0
            {
                  output = 0
            }
            if ( output > 127 ) // check for overrun
            {
                  output = 127 ;
            }
            if ( output < -127 ) // check for underrun
            {
                  output = -127 ;
            }
            SetMotor ( 1 , (int)output+127 ) ; // Write to the motors
            SetMotor ( 2 , (int)output-127 ) ; // Write to the motors
            Wait ( 20 ) ; // Delay Loop Time Higher will make the ramp slower/ lower will make it faster
      }
}