TTGO-T-Display ESP32

Hello.
I need several analog inputs for my project. If I use input 36 the analog input reads fine.
The problem is if I define more inputs, they all show up only as pin 36. Example: set input 39 with 3.3 volts, the reading of the pin 39 is 0 but pin 36 is 4095 with 0 volts on pin 36..

My test:
// Potentiometer is connected to GPIO 34 (Analog ADC1_CH6)
const int potPin = 36;
const int potPin2 = 39;

// variable for storing the potentiometer value
int potValue = 0;
int potValue2 = 0;

void setup() {
Serial.begin(115200);
delay(1000);
}

void loop() {
// Reading potentiometer value
potValue = analogRead(potPin);
potValue = analogRead(potPin2);
Serial.print("36 is ");
Serial.println(potValue);
Serial.print("39 is ");
Serial.println(potValue2);
delay(500);
}

Pinout:
http://www.lilygo.cn/prod_view.aspx?TypeId=50033&Id=1126&FId=t3:50033:3

@urfalo, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with your project :wink: See About the Installation & Troubleshooting category.

potValue = analogRead(potPin);
potValue = analogRead(potPin2);

Look very carefully at those 2 lines of code and check they are really doing what you think.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.