Serialprint is different if written first to variable

you need to code what has been suggested in #4 about the interrupt as well. You have a critical section where you use things that can be modified behind your back during the math.