// new prog
#include <Adafruit_GFX.h> // include Adafruit graphics library
#include <Adafruit_ILI9341.h> // include Adafruit ILI9341 TFT library
#define TFT_CS 8 // TFT CS pin is connected to arduino pin 8
#define TFT_RST 9 // TFT RST pin is connected to arduino pin 9
#define TFT_DC 10 // TFT DC pin is connected to arduino pin 10
#define TS_MINX 212 //raw data value provided when the minimum "X" position of the screen is touched
#define TS_MINY 207 //raw data value provided when the minimum "Y" position of the screen is touched
#define TS_MAXX 937 //raw data value provided when the maximum "X" position of the screen is touched
#define TS_MAXY 936 //raw data value provided when the maximum "Y" position of the screen is touched
// When writing to the display a specific color will be specified.
// The library uses a hex value (hexadecimal) but it is convenient to use "names"
// Below are the Hex values for the "named" graphic colors used in this sketch
#define BLUE 0x001F
#define RED 0xF800
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
// initialize ILI9341 TFT library
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
//TouchScreen ts = TouchScreen(XP, YP, XM, YM, 303);
void setup() {
//******|Initialize the LCD display|*******
//tft.reset();
tft.begin(0x9341); // Manually set the LCD identifier, the LCD specified use the ILI9341 driver chip
tft.setRotation(2); // Rotation can be a value from 0 to 3, changing this will rotate what is written to the display
tft.setTextColor(YELLOW); // Set the default text color to be yellow
tft.setTextSize(1); // Set default text size, "1" is smallest font
//tft.fillScreen(BLUE); // Paint the entire screen blue
tft.drawRect(2, 2, 235, 316, WHITE); // Draw a white border around the display
tft.drawRect(3, 3, 233, 314, WHITE); // Draw the Border again, offset by 1 pixel
tft.fillRoundRect(30, 7, 180, 28, 8, RED); // Draw a message area at top of screen, make it red
tft.drawRoundRect(30, 7, 180, 28, 8, WHITE); // Draw white border arround message area
}
void loop()
{
}
Loading
ili9341-cap-touch
ili9341-cap-touch