Welcome to this forum - an approach could be using a variable which is incremented or decremented depending on which button is pressed and that variable is involved in the timing... or if you need two different rates for which way you are going then use two variables... Decrement a timing variable each time you sample the input buttons and reset it when no input button detected - what have you got so far?