So here is an example code
void setup() {
Serial.begin(9600); //Baud rate: 9600
}
void loop() {
int sensorValue = analogRead(A0);// read the input on analog pin 0:
float voltage = sensorValue * (5.0 / 1024.0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
Serial.println(voltage); // print out the value you read:
delay(500);
}
The sensor is operating on 5V, it is powered by an external power supply. But, I am using an ESP32. My question is can I use the code as it is or should I use (3.3 / 4096) instead of (5.0 / 1024.0)?