The problem is with your usage of the
millisecond timer. It has no reference time (i.e. millisecond zero is just an arbitrary point in time). Therefore, you have to measure the
change in timer value, which will give you milliseconds elapsed. Try the attached snippet instead.