When I first looked at your description (not code) I thought you may be using recursion.
I then realised that you had created a Variable and I immediately thought, this can’t be the case, wouldn’t Timer be a reserved word in the language but when you look at the Arduino code the mBlock Timer block is actually the lastTime keyword in the language.
Good to know and one of the reasons that I like the mBlock programing IDE for teaching with, it shows what the real text based code that is being written in the Arduino IDE and then used to compile to the native language of the robot.
The two windows make for a great teaching tool at any level.
Well spotted Chuck
How to run multiple tasks?
Tards57
#21