What correlation do YOU expect there to be between moving the slider and pressing buttons? If the buttons represent forward and backward as ON or OFF, then the slider isn't an appropriate replacement.
If the forward button can be pressed repeatedly to increase the forward speed, then the slider MIGHT make a suitable substitute. The middle position of the slider would need to be 0, with the upper end representing the maximum number of "up" buttons presses required to make the motor go full speed forward, and the lower end representing the equivalent value for the "down" button.