ReadAnalog GPIO12
-
I have started using the Lilygo T-Display-s3, and in my application I connected GPIO12 to measure an analog voltage between 0 and 3Vdc.
I should be pretty straight forward, I set the PinMode for GPIO12 as INPUT and used the ReadAnalog function with the GPIO12 pin (12)....However, for some reason it does not read the voltage at all....
GPIO12 is supposed to share operation with the ADC2 CH1, is there any setup that is required, that I'm not familiar with? -
Hi! I used this code, just now to read the battery voltage from GPIO4.
Do not to declare Input as INPUT modetop of the sketch:
#define analogPin 4 //the built in battery voltage test point
float val = 1.23; //a test number to check if I'm getting a real valuein "setup"
Serial.begin(115200); // be sure to set USB CDC On Boot: "Enabled"The entire test loop:
void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val/1000); // testing value
delay(1000);
}That's it...I'm getting 2.94VDC.
The ESP32 has terrible ADC capabilities, so this is it!I also have a LilyGO T-Display S3 support page on GitHub here:
https://github.com/teastainGit/LilyGO-T-display-S3-setup-and-examples
lots of goodies
-Terry