Hello, I'm kinda losing my mind here. I'm trying to read an analog value using an Original Arduino Nano ESP32. Attached in the link you can see the wiring. It's very basic. Using a multimeter between GND and the orange marked wire I can read the voltage difference as I use the slider. The arduino however reads nothing on the serial monitor. Even if I just hook the analog pin to 3V3 there is nothing read. Software wise, all I'm using is an unmodified "AanalogRead".
I thought that would be neccessary since I'm using an unmodified example sketech but here you go:
void setup() {
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);
//set the resolution to 12 bits (0-4096)
analogReadResolution(12);
}
void loop() {
// read the analog / millivolts value for pin 2:
int analogValue = analogRead(2);
int analogVolts = analogReadMilliVolts(2);
// print out the values you read:
Serial.printf("ADC analog value = %d\n",analogValue);
Serial.printf("ADC millivolts value = %d\n",analogVolts);
delay(100); // delay in between reads for clear read from serial
}
Quick note:
I found the solution, the Arduino basic sketch is incorrect. Instead of analogRead(2) it must be analogRead(A2).