Skip to content

Library for the XPT2046 touch chip for Particle devices

License

Notifications You must be signed in to change notification settings

vritzka/XPT2046_Touch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XPT2046 Touch sensor chip for Particle

A Particle library for XPT2046.

Ported from Paul Stoffregen's Arduino version.

Usage

Connect the chip like this

DO --- MISO A4
DI --- MOSI A5
CLK --- SCK A3
SS -- (you will chose this pin in the application)

The library can use SPI or SPI1.

#include "XPT2046_touch.h"
#define CS_PIN D5    //ChipSelect or SlaveSelect Pin
#define TIRQ_PIN D1 // interrupt pin

XPT2046_Touchscreen ts(SPI, CS_PIN, TIRQ_PIN);

void setup() {
  ts.begin();
  ts.setRotation(3); 
  
  Serial.begin();
}

void loop() {
    if (ts.touched()) {
      TS_Point p = ts.getPoint();
      Serial.print("Pressure = ");
      Serial.print(p.z);
      Serial.print(", x = ");
      Serial.print(p.x);
      Serial.print(", y = ");
      Serial.print(p.y);
      delay(30);
      Serial.println();
 }
}

See the examples folder for more details.

Licensed under the MIT license

About

Library for the XPT2046 touch chip for Particle devices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages