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

How to find 4-wire resistance touchscreen feature #21

Open
nopnop2002 opened this issue Dec 13, 2021 · 0 comments
Open

How to find 4-wire resistance touchscreen feature #21

nopnop2002 opened this issue Dec 13, 2021 · 0 comments

Comments

@nopnop2002
Copy link
Owner

nopnop2002 commented Dec 13, 2021

You can't tell at a glance if your TFT has a 4-wire resistor touchscreen feature.

An easy way to find the 4-wire resistance touchscreen feature is to perform this sketch using UNO.

https://github.com/Seeed-Studio/Touch_Screen_Driver

#include <stdint.h>
#include <SeeedTouchScreen.h> 

// for OpenSmart 16pin TFT
#if 0
#define YP A2   // must be an analog pin, use "An" notation!(LCD_WR)
#define XM A1   // must be an analog pin, use "An" notation!(LCD_RS)
#define YM 14   // can be a digital pin, this is A0(LCD_D7)
#define XP 17   // can be a digital pin, this is A3(LCD_D6) 
#endif

// for OpenSmart Shield
#if 0
#define YP A1   // must be an analog pin, use "An" notation!(LCD_WR)
#define XM A2   // must be an analog pin, use "An" notation!(LCD_RS)
#define YM 7    // can be a digital pin, this is D7(LCD_D7)
#define XP 6    // can be a digital pin, this is D6(LCD_D6) 
#endif

// for ELEGOO Shield
// for Generic ILI9341
#if 1
#define YP A3  // must be an analog pin, use "An" notation!(LCD_CS)
#define XM A2  // must be an analog pin, use "An" notation!(LCD_RS)
#define YM 9   // can be a digital pin(LCD_D1)
#define XP 8   // can be a digital pin(LCD_D0)
#endif



// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// The 2.8" TFT Touch shield has 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM);

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

void loop(void) {
  // a point object holds x y and z coordinates
  Point p = ts.getPoint();

  if (p.z > __PRESURE) {
     Serial.print("Raw X = "); Serial.print(p.x);
     Serial.print("\tRaw Y = "); Serial.print(p.y);
     Serial.print("\tPressure = "); Serial.println(p.z);
  }
  
  delay(100);
}
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

1 participant