Example: ReadAnalogVoltage,input 3.3V,get 5V ,input 5V,get 4.2V in monitor!!!!!

Hello guys,

My board is Nano 33Ble sense, and I use the example of Basics: ReadAnalogVoltage. I set the 10 bits resolution.But I can't get the right value.
Eg:I connect the A0 cable to the 3.3V on the board, but the output value monitor get is almost 1023,which translates to voltage 5V.

I don't know why!!??

The nano BLE is a 3.3v system, 1023 from the a to d represents a voltage of 3.3V, put in 5.5v and you could damage the it.

Change the line

float voltage = sensorValue * (5.0 / 1023.0);


float voltage = sensorValue * (3.3 / 1023.0);