Detecting movement of traffic to be counted or controlled with provision for distinguishing direction of travel