Advertisement
RuiViana

N_LCD

Jun 20th, 2016
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.61 KB | None | 0 0
  1.   #include <Adafruit_GFX.h>    // Core graphics library
  2.   #include <Adafruit_TFTLCD.h> // Hardware-specific library
  3.   #include <TouchScreen.h>
  4.  
  5.   #define YP A3 // Y+ is on Analog1
  6.   #define XM A2 // X- is on Analog2
  7.   #define YM 9 // Y- is on Digital7
  8.   #define XP 8 // X+ is on Digital6
  9.  
  10.   #define TS_MINX 150
  11.   #define TS_MINY 120
  12.   #define TS_MAXX 920
  13.   #define TS_MAXY 940
  14.  
  15.   TouchScreen ts = TouchScreen(XP, YP, XM, YM, 100);
  16.  
  17.   //Definicao de cores
  18.   #define BLACK           0x0000
  19.   #define BLUE            0x001F
  20.   #define RED             0xF800
  21.   #define GREEN           0x07E0
  22.   #define CYAN            0x07FF
  23.   #define MAGENTA         0xF81F
  24.   #define YELLOW          0xFFE0
  25.   #define WHITE           0xFFFF
  26.  
  27.   //PP_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
  28.   Adafruit_TFTLCD tft(A3, A2, A1, A0, A4);
  29.  
  30.   char tecla;
  31.   boolean a = 1;
  32.  
  33.   int rotacao = 1;   //// rotação pode ser 1 ou 3
  34.   int ymenor = 0;
  35.   int ymaior = 0;
  36.   int xmenor = 0;
  37.   int xmaior = 0;
  38.   int control = 0;
  39.  
  40.   #define MINPRESSURE 10
  41.   #define MAXPRESSURE 1000
  42.  
  43.   void setup(void)
  44.   {
  45.     Serial.begin(9600);
  46.     tft.reset();
  47.     delay(500);
  48.     tft.begin(0x9341);
  49.     tft.setRotation(rotacao);
  50.     tft.fillScreen(BLACK);
  51.   }
  52.  
  53.   void loop()
  54.   {
  55.     while (Serial.available())
  56.     {
  57.       tecla = Serial.read();
  58.       control++;
  59.           //tft.drawRoundRect(158, 24, 68, 29, 5, WHITE);///botao girar
  60.       tft.setTextColor(WHITE);
  61.       tft.setTextSize(6);
  62.       tft.setCursor(60+control, 30);
  63.       tft.println(tecla);
  64.       //delay(100);
  65.     }
  66.     control = 0;
  67.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement