Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

ESP32 with a Resistive Touch Screen -- How to work with "An"
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ESP32 with a Resistive Touch Screen -- How to work with "An"

by Munque on Tue Jan 18, 2022 9:57 am

I'm using this Touch screen - 3.7" with this breakout board, connected to an ESP32-WROOM, testing with this Adafruit code.

Looking to better understand these lines...

Code: Select all | TOGGLE FULL SIZE
#define YP A2  // must be an analog pin, use "An" notation!
#define XM A3  // must be an analog pin, use "An" notation!
#define YM 8   // can be a digital pin
#define XP 9   // can be a digital pin


How to determine which pins on the board correspond to "An" notation, whether for the ESP32-WROOM specifically or any MCU?
Also double-checking: The XM & XP values, 8 & 9, are GPIO numbers, correct? or something else?

Munque
 
Posts: 17
Joined: Fri Apr 12, 2019 11:51 pm

Re: ESP32 with a Resistive Touch Screen -- How to work with

by rpiloverbd on Tue Jan 18, 2022 11:13 am

These lines simply mean that YP and XM must be always connected to analog pins. In this code A2 and A3 have been used. In case of Arduino UNO, you can choose any pin from A0 to A5. In case of ESP32 wroom, you can connect YP and XM to any two pins of ADC1 or ADC2. Here is the pinout for your reference. https://circuits4you.com/2018/12/31/esp ... io-pinout/

rpiloverbd
 
Posts: 198
Joined: Mon Nov 29, 2021 8:13 am

Re: ESP32 with a Resistive Touch Screen -- How to work with

by Munque on Tue Jan 18, 2022 2:08 pm

These lines simply mean that YP and XM must be always connected to analog pins. In this code A2 and A3 have been used. In case of Arduino UNO, you can choose any pin from A0 to A5. In case of ESP32 wroom, you can connect YP and XM to any two pins of ADC1 or ADC2. Here is the pinout for your reference. https://circuits4you.com/2018/12/31/esp ... io-pinout/


Thanks for the reply. On ESP32 the challenge was figuring out how to relate "An" notation to the pinouts map. If I'm reading it correctly, there are two groupings of analog pins, one set with a prefix "ADC1" (showing #s 0, 3 - 7), the other "ADC2" (showing #s 0, & 2 - 9) I'm unfamiliar with the logic of "An" notation. Given all the prefixes, number sequences, along with the GPIOs I wasn't sure what to use, and so far, no attempts are successful. I'm getting no readings from the device.

What is the logic of "An" notation?

Munque
 
Posts: 17
Joined: Fri Apr 12, 2019 11:51 pm

Re: ESP32 with a Resistive Touch Screen -- How to work with

by Munque on Tue Jan 18, 2022 2:37 pm

I'm testing using the following...

GPIO 13 connected to Y+ (On the pinouts is listed as ADC2_4)
GPIO 12 connected to X- (On the pinouts is listed as ADC2_5)
GPIO 14 connected to Y-
GPIO 27 connected to X+

The touchscreen ribbon connects to breakout with the exposed leads facing up.

Tested the above using various permutations and combinations:

#define YP A4 // based on "ADC2_4"
#define XM A5 // based on "ADC2_4"
#define YM 14
#define XP 27

#define YP A13 // GPIO #
#define XM A12 // GPIO #
#define YM 14
#define XP 27

Also reversed the ribbon direction, facing down / facing up

So far no luck. I figure I'm not understanding something more basic about "An" notation.

Munque
 
Posts: 17
Joined: Fri Apr 12, 2019 11:51 pm

Re: ESP32 with a Resistive Touch Screen -- How to work with

by Munque on Tue Jan 18, 2022 2:48 pm

SOLVED with help from info from this link.

The ADC2 group of pins apparently conflicts with WiFi, and their "An" names don't correspond directly to the number as listed on the pinouts (you have to add 10).
The ADC1 group of pins' "An" names do correspond.

Munque
 
Posts: 17
Joined: Fri Apr 12, 2019 11:51 pm

Re: ESP32 with a Resistive Touch Screen -- How to work with

by rpiloverbd on Wed Jan 19, 2022 7:41 am

Oh. Good to know that it's working. Thanks for sharing the solution with us. It will will many in the future.

rpiloverbd
 
Posts: 198
Joined: Mon Nov 29, 2021 8:13 am

Please be positive and constructive with your questions and comments.