Calculating time/duration
Posted: Sun 29. Jun 2014, 03:47
Hello,
I have CAN activity in which messages are sent to activate 3 motors and deactivate them. With a standard macro, I want to calculate and display the duration of each motor from start to stop using printToOutputWindow.
I was able to trigger the code on start and stop using waitData for each state, but I cannot find out how to calculate and display the time between two waitData lines. To explain further, the code looks like this:
//wait for motor 1 to start:
waitData 0 1 120h 9 13h 10h * * * * * *
//start calculating time here
//stop calculating time at:
waitData 0 1 220h 9 14h 10h * * * * * *
//display calculated time using printToOutputWindow or any other method
Is it possible to do this with a standard macro? If yes then how? And if no, what alternative is possible?
Thank you.
I have CAN activity in which messages are sent to activate 3 motors and deactivate them. With a standard macro, I want to calculate and display the duration of each motor from start to stop using printToOutputWindow.
I was able to trigger the code on start and stop using waitData for each state, but I cannot find out how to calculate and display the time between two waitData lines. To explain further, the code looks like this:
//wait for motor 1 to start:
waitData 0 1 120h 9 13h 10h * * * * * *
//start calculating time here
//stop calculating time at:
waitData 0 1 220h 9 14h 10h * * * * * *
//display calculated time using printToOutputWindow or any other method
Is it possible to do this with a standard macro? If yes then how? And if no, what alternative is possible?
Thank you.