Out of 8 free pins ( 0, 1, 5, 12, A0, A2, A3, and A4 ), 7 pins ( 0, 1, 5, A0, A2, A3, and A4 ) are working correctly but
pin 12’s voltage is always 0 and not working.
I checked the voltage of pin 12 without connecting sensor and it’s 0V, (other free pins are about 5V)
When I connect the sensor to pin 12, the indicator of the sensor goes immediately 0 and is always 0 regardless of the sensing state.
The user guide says the following but I am not sure if it’s related to my case.
Pin 5 (PC6) is a hardware PWM output and is usable with the Arduino analogWrite() function. Pin 12 (A11/PD6) can also be used as a PWM output, but it is not supported by analogWrite(), and using pin 12 for PWM might conflict with uses of pin 6 (which controls the buzzer by default) as these two pins are complementary outputs of Timer4 channel D.
Pins 12 (A11/PD6), A0 (18/PF7), A2 (20/PF5), A3 (21/PF4), and A4 (22/PF1) can be used as analog inputs.
Pin 12 should not require any special configuration and there are no onboard peripherals that use it. Are you initializing it as a digital input? Have you tried to disconnect the sensor and initialize that pin to use the internal pullup resistor or as an output (with a digital write) to see if it changes state?