Updated Arduino code to incorporate object detection and avoidance