I am using a stepper motor to tilt my blinds. Pressing the buttons, one will turn 100 steps one direction (CW) and the other 100 steps the other way (CCW).
However occasionally the user may stop the stepper by pressing any button and the position could be, for example 143.
If the user press CW or CCW buttons again I want the number to either round up to 200 or round down to 100 depending on the button pressed. Lambda ceiling or round might be a clue but not sure how to write it.