( Start value - End value ) / ( time * 10 )I seems to work OK for values I try, but I might need to try with some weird values to see if it still holds up - 33 - 101 over 5 seconds ??
(68 steps over 5 seconds or 50 interrupts = change by 1.36 per interrupt !! aaarg !)
( 33 - 101 ) = use the ABS function to get the real difference between the 2 = 68
( 5 * 10 ) = 50
68 / 50 = 1.36
True, not doable in PBP...but...a bit of scaling will take care of that...
68 * 100 = 6800 / 50 = 136
Keep track of your steps/interrupts...
1st step = 6800 / 50 * step (1 in this case) = 136 / 100 = 1.36, rounds down to 1, add to start = 34
2nd step = 6800 / 50 * 2 = 272 / 100 = 2.72, rounds down to 2, add to start = 35
3rd step = 6800 / 50 * 3 = 408 / 100 = 4.08, rounds down to 4, add to start = 36
...blah blah blah...
49th step = 6800 / 50 * 49 = 6664 / 100 = 66.64, rounds down to 66, add to the start value = 99.
50th step = 6800 / 50 * 50 = 6800 / 100 = 68, add to start value = 101
Bookmarks