how to gradually increase byte from value A to value B in a specified time?

Hello, I’m trying to make a byte whose value could be gradually increased from value A to value B (for example from 30 to 127) in a specified time (for example 2 seconds). The best functioning method for me was Set Timer By Event where the event is just A+1 until it equals value B. But there are a few problems - how do I find out how much time “per step” (when counting from 30 to 127 → 97 steps exactly) there should be so it totals to 2 seconds? And what if I simultaneously trigger function to decrease the value? How do I stop the increasing function so it just doesn’t get stuck simultaneously increasing and decreasing?

1 Like