├── LICENSE
├── README.md
└── main.ino
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Abhineet Raj
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Arduino tft display project
2 |
3 | ## Requirements
4 | * Arduino UNO board
5 | * Arduino tft display
6 |
7 |
8 | # Installation
9 | * Download Arduino IDE.
10 | * Open main.ino file and upload the code into arduino board.
11 | * Attach tft display to arduino board
12 | * Run your Arduino :)
13 |
14 | # Programming languages used:-
15 |
16 | ## Author
17 | * [abhineetraj1](http://github.com/abhineetraj1)
18 |
--------------------------------------------------------------------------------
/main.ino:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #define LCD_CS A3
6 | #define LCD_CD A2
7 | #define LCD_WR A1
8 | #define LCD_RD A0
9 | #define LCD_RESET A4
10 |
11 | #define TS_MINX 122
12 | #define TS_MINY 111
13 | #define TS_MAXX 942
14 | #define TS_MAXY 890
15 |
16 | #define YP A3
17 | #define XM A2
18 | #define YM 9
19 | #define XP 8
20 |
21 | #define BLACK 0x0000
22 | #define BLUE 0x001F
23 | #define RED 0xF800
24 | #define GREEN 0x07E0
25 | #define CYAN 0x07FF
26 | #define MAGENTA 0xF81F
27 | #define YELLOW 0xFFE0
28 | #define WHITE 0xFFFF
29 |
30 | Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
31 |
32 | TouchScreen ts = TouchScreen(XP, YP, XM, YM, 364);
33 |
34 | boolean buttonEnabled = true;
35 |
36 | void setup() {
37 |
38 | tft.reset();
39 | uint16_t identifier = tft.readID();
40 | tft.begin(identifier);
41 | tft.setRotation(1);
42 | tft.fillScreen(WHITE);
43 | tft.drawRect(0,0,319,240,YELLOW);
44 |
45 | tft.setCursor(30,40);
46 | tft.setTextColor(BLACK);
47 | tft.setTextSize(2);
48 | tft.print("TFT LCD Touch Screen");
49 |
50 | tft.setCursor(115,80);
51 | tft.setTextColor(BLACK);
52 | tft.setTextSize(2);
53 | tft.print("Project\n\n by");
54 |
55 | tft.setCursor(30,150);
56 | tft.setTextColor(BLUE);
57 | tft.setTextSize(2);
58 | tft.print("Abhineet Raj");
59 |
60 | tft.fillRect(50,180, 210, 40, BLACK);
61 | tft.drawRect(50,180,210,40,BLACK);
62 | tft.setCursor(60,190);
63 | tft.setTextColor(WHITE);
64 | tft.setTextSize(2);
65 | tft.print("Follow github");
66 |
67 | }
68 |
69 | void loop() {
70 | TSPoint p = ts.getPoint();
71 |
72 | if (p.z > ts.pressureThreshhold) {
73 |
74 | p.x = map(p.x, TS_MAXX, TS_MINX, 0, 320);
75 | p.y = map(p.y, TS_MAXY, TS_MINY, 0, 480);
76 |
77 | if(p.x>50 && p.x<260 && p.y>180 && p.y<270 && buttonEnabled){
78 |
79 | buttonEnabled = false;
80 |
81 | pinMode(XM, OUTPUT);
82 | pinMode(YP, OUTPUT);
83 |
84 | tft.fillScreen(WHITE);
85 | tft.setCursor(50,70);
86 | tft.setTextColor(BLACK);
87 | tft.setTextSize(3);
88 | tft.print(" Thank you\n\n -> Star your favourite\n repository in my \n github account");
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------