Skip to content

Instantly share code, notes, and snippets.

@circuitsenses
Created August 31, 2014 06:12
Show Gist options
  • Save circuitsenses/6f6483a82510977b219b to your computer and use it in GitHub Desktop.
Save circuitsenses/6f6483a82510977b219b to your computer and use it in GitHub Desktop.
ADS7843 Touchscreen
#include <ads7843.h>
#define DCLK 51 // SCLK
#define CS 46 // CS
#define DIN 48 // MISO
#define DOUT 47 // MOSI
#define IRQ 49
ADS7843 touch(CS, DCLK, DIN, DOUT, IRQ);
Point p;
void setup(void)
{
Serial.begin(115200);
touch.begin();
}
void loop(void)
{
uint8_t flag;
/** getpos */
p=touch.getpos(&flag) ;
if(flag){
/** get position successfully */
/** print the coordinate */
Serial.print(p.x, DEC);
Serial.print(" ");
Serial.print(p.y, DEC);
Serial.println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment