detect direction of rotating