Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <UTFT.h>
  2. #include <URTouch.h>
  3.  
  4. UTFT    myGLCD(ILI9481, 38, 39, 40, 41);
  5.  
  6. URTouch  myTouch(53, 52, 50, 51, 44);
  7.  
  8. // Declare which fonts we will be using
  9. extern uint8_t BigFont[];
  10.  
  11. int color = 0;
  12. word colorlist[] = {VGA_WHITE, VGA_BLACK};
  13. int  bsize = 4;
  14.  
  15. void setup()
  16. {
  17.   myGLCD.InitLCD();
  18.   myGLCD.clrScr();
  19.   myGLCD.setFont(BigFont);
  20.   myTouch.InitTouch();
  21.   myTouch.setPrecision(PREC_HI);
  22.   myGLCD.fillScr(VGA_BLACK);
  23.   myGLCD.setColor(VGA_WHITE);
  24.   myGLCD.print("X=", 0, 0);
  25.   myGLCD.print("Y=", 0, 16);
  26. }
  27.  
  28. void loop()
  29. {
  30.   if (myTouch.dataAvailable())
  31.   {
  32.     myTouch.calibrateRead();
  33.     myGLCD.print(String(myTouch.TP_X), 32, 0);
  34.     myGLCD.print(String(myTouch.TP_Y), 32, 16);
  35.   }
  36.   else {
  37.     myGLCD.print("no touch", 32, 0);
  38.     myGLCD.print("no touch", 32, 16);
  39.   }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement