Hello All,
I am trying to get the touchscreen on my HX8357 breakout from adafruit, but I’m really not having much luck.
I’ve seen a number of posts regarding the resolution, so I updated the code to reduce the resolution to 10 bits. I’ve check my wiring a number of times as well, and I’m fairly confident this is wired correctly. Here’s the code I am using to test:
#include <Adafruit_GFX.h> // Core graphics library
#include <SPI.h>
#include "Adafruit_HX8357.h"
#include "TouchScreen.h"
// ESP32 Thing Plus USBC TS Pins
#define YP A1 // must be an analog pin, use "An" notation!
#define XM A0 // must be an analog pin, use "An" notation!
#define YM 13 // can be a digital pin
#define XP 12 // can be a digital pin
// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
void setup(void) {
Serial.begin(115200);
}
void loop()
{
// Retrieve a point
analogReadResolution(10);
TSPoint p = ts.getPoint();
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);
delay(200);
}
This code returns this (X= 1023 when touching the display, X=800ish when not touching):
X = 1023 Y = 751 Pressure = 0
X = 1023 Y = 751 Pressure = 0
X = 1023 Y = 751 Pressure = 0
X = 867 Y = 763 Pressure = 0
X = 800 Y = 770 Pressure = 0
X = 806 Y = 769 Pressure = 0
I suspect this is a pin selection related issue, or that I may need a pull-up/down somewhere, but I’m kind of at a stand still. Has anyone resolved this issue?
Nate