I'm progressing well with my crane project. An issue I have
next on my 'checklist' is getting the speed to be the same on any
machine. At the moment, when a button is pressed, it sets a
variable to a value, i.e 'inchLoad' which calls a function to move
the load up.
To get comparable motions on a wide range of machines you
need some timebased motion. This can be done by using
Timeoutobjects, mesure the elapsed milliseconds between frames or
I posted some time ago a littel demo with the
"registerforevent" method, you can find it here:
polygones and register for event
I think the best way is to mesure the elapsed milliseconds
and use the result to calculate the motion. Using registerforevent
is not very confortable because you can not "unregister" a single
In short, you need to pass a 'time delta' to your function,
and multiply your distance (0.2) by your time delta. The time delta
should be calculated by examining the amount of time elapsed since
the last frame.
Alternatively you could reduce the distance moved each time
the function is called, and call your function a number of times
each frame. The number of times you call it should be based on the
time elapsed since the last frame.