I would not recommend this, because a sensor with 7V operating voltage means its output is also usually at that voltage level, which is above the controller’s operating voltage. If you have to use this sensor, I suggest that you either use a resistor voltage divider, or a resistor plus a zener diode to reduce the output voltage down to 5V, which is safe for the controller’s sensor pin.