#include <Adafruit_GFX.h>
#include <Adafruit_FT6206.h>
#include <Adafruit_ILI9341.h>
static byte SPI_PIN_CS = 10;
static byte PIN_DC = 9;
static byte PIN_RST = 8;
static byte X_SPACE = 40;
static byte Y_SPACE = 40;
uint32_t pixelColor;
int c = 0;
int scale = 1, saver = scale;
Adafruit_ILI9341 tft = Adafruit_ILI9341(SPI_PIN_CS, PIN_DC, PIN_SPI_MOSI, PIN_SPI_SCK, PIN_RST, PIN_SPI_MISO);
Adafruit_FT6206 ts = Adafruit_FT6206();
void setup() {
Serial.begin(11540);
tft.begin(); //Initalizes the object called "tft" under the Adafruit ILI9341 Library
tft.setRotation(1); //Conforms the tft to be at the same rotation as the Capacitive Touch
ts.begin(); //Initalizes the object ccalled "ts" under the Adafruit FT6206 Libary in I2C
pixelColor = ILI9341_RED;
tft.fillScreen(ILI9341_WHITE);
Serial.println("Enter a scale to get bigger dots!");
}
void loop() {
int x=0, y=0, i=0;
if(c == 0){
tft.setTextSize(3);
tft.setTextColor(ILI9341_BLACK);
tft.setCursor(20,50);
tft.println("REGISTRAR");
tft.setCursor(20,80);
tft.println("NOVO");
tft.setCursor(20,110);
tft.println("TREINO");
tft.fillRect(10,150,300,80, ILI9341_BLACK);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(5);
tft.setCursor(60,190);
tft.print("INICIAR");
c++;
}
TS_Point p = ts.getPoint();
while(i == 0)
{
TS_Point p = ts.getPoint();
x=p.x;
y=p.y;
if(x >= 10 && p.x <= 80 && y >= 10 && y <= 310)
{
tft.fillScreen(ILI9341_WHITE);
i++;
}
else
{
continue;
}
}
tft.drawRoundRect(11,11,224,58,3,ILI9341_BLACK);
tft.fillRoundRect(11,181,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(11,131,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(11,81,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(86,181,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(86,131,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(86,81,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(161,181,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(161,131,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(161,81,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(236,81,73,48,3, ILI9341_BLACK);
tft.fillRoundRect(236,11,75,58,3, ILI9341_RED);
tft.drawRoundRect(236,11,75,58,3, ILI9341_BLACK);
tft.fillRoundRect(236,131,73,98,3, ILI9341_GREEN);
tft.drawRoundRect(236,131,73,98,3, ILI9341_BLACK);
}
Loading
ili9341-cap-touch
ili9341-cap-touch