#include <Adafruit_ILI9341.h>
#include <Adafruit_GFX.h>
#define ptx1 (A0, INPUT);
#define ptx2 (A1, INPUT);
#define relay1 (2, OUTPUT);
#define relay2 (3, OUTPUT);
#define relay3 (4, OUTPUT);
void setup () {
Serial.begin(9600);
tft.begin();
screenRedrawNecessary = true;
}
void loop()
{
/* Touch input detection omitted. See below */
if (screenRedrawNecessary)
{
resetAndClearScreen();
drawIntroText();
drawTouchButton(b1[0], b1[1], b1[2], b1[3], "Previous");
drawTouchButton(b2[0], b2[1], b2[2], b2[3], "Next");
screenRedrawNecessary = false;
}
}
void drawIntroText(void)
{
tft.setCursor(15, 15);
tft.setTextColor(font_colors[active_colors]);
tft.setTextSize(2);
tft.println("Hello, World!");
tft.setCursor(15, 55);
tft.println("Use the buttons below");
tft.setCursor(15, 75);
tft.println("to change the background");
tft.setCursor(15, 95);
tft.println("color!");
}
Loading
ili9341-cap-touch
ili9341-cap-touch