private void PollSensorAndFireEventIfNeeded() { double dist = distanceSensor.GetDistance(relativeDirection, minMapValueForObstacles, maxDistance); if (dist < maxDistance) OnWallDetected?.Invoke(dist); }
private void _timer_Tick(object sender, object e) { distanceLabel.Text = String.Format("Distance: {0} cm", ((long)_distance.GetDistance()).ToString()); }