Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch Screen library assumes 10 bit A/D? #39

Open
professorwade opened this issue Feb 15, 2023 · 4 comments
Open

Touch Screen library assumes 10 bit A/D? #39

professorwade opened this issue Feb 15, 2023 · 4 comments

Comments

@professorwade
Copy link

Question: I noticed a number of 1024 and 1023 in the TouchScreen library and wonder if it is related to an assumption of a 10 bit A/D (i.e. Arduino 8-bit)? I am using the library with a SAMD51 part (Grand Central) and notice that the values tend to be much higher on the pressure.

y = (1023 - samples[NUMSAMPLES / 2]);

@MaitrePoulier
Copy link

MaitrePoulier commented May 2, 2023

I came to the exact same conclusion for the ESP32-S2 wich have an ADC of 13 bits.
If you chage the 6 instances of the number 1023 with the #bits^2 (8191 in my case) it should work.

@ladyada
Copy link
Member

ladyada commented May 3, 2023

probably best to just set the adc resolution in the examples before use - wanna try that?
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogreadresolution/

@MaitrePoulier
Copy link

The problem with analogreadresolution() is that is work only with the: Zero, Due & MKR Family, not the ESP32-S2

@ScruffR
Copy link

ScruffR commented Oct 15, 2023

I just filed a pull-request to solve that problem
#43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants