Skip to content

How to find 4-wire resistance touchscreen feature #21

@nopnop2002

Description

@nopnop2002

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions