/**
Arduino MEGA adaptation by https://wokwi.com/makers/gjchen
First demo for FT6206 Capactive Touch Screen on Wokwi. Enjoy!
https://wokwi.com/arduino/projects/376916542459428865
*/
/**
ESP32s3 adaptation by Tyeth Gundry of Arduino version of
First demo for FT6206 Capactive Touch Screen on Wokwi. Enjoy!
https://wokwi.com/arduino/projects/311598148845830720
*/
/***************************************************
This is our touchscreen painting example for the Adafruit ILI9341
captouch shield
----> http://www.adafruit.com/products/1947
Check out the links above for our tutorials and wiring diagrams
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include <Adafruit_GFX.h> // Core graphics library
#include <SPI.h> // this is needed for display
#include <Adafruit_ILI9341.h>
#include <Arduino.h> // this is needed for FT6206
#include <Adafruit_FT6206.h>
// The FT6206 uses hardware I2C (SCL/SDA)
Adafruit_FT6206 ctp = Adafruit_FT6206();
// // The display also uses hardware SPI, plus #9 & #10
#define TFT_CS 10
#define TFT_DC 9
//#define TFT_DC 53
//#define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// Size of the color selection boxes and the paintbrush size
#define BOXSIZE 40
#define PENRADIUS 3
#define BLACK 0x0000
#define RED 0xF800
#define GREEN 0x07E0
#define WHITE 0xFFFF
int oldcolor, currentcolor;
void setup(void) {
//while (!Serial); // used for leonardo debugging
Serial.begin(115200);
Serial.println(F("Cap Touch Paint!"));
Wire.begin(); // redefine first I2C port to be on pins 10/8
tft.begin();
tft.setRotation(1);
// tft.setFont(&FreeSans9pt7b);
tft.fillScreen(0x22d1);
tft.setCursor(80,50);
tft.setTextColor(0xFFFF);
tft.setTextSize(4.2);
tft.print(("WELCOME!"));
Adafruit_GFX_Button Sensor1_Button,Sensor2_Button,Sensor4_Button,Sensor3_Button;
Sensor1_Button.initButton(&tft, 55, 140, 130, 40, 0x463f, WHITE, 0x463f, " Sensor 1",2 );
Sensor1_Button.drawButton(true);
Sensor2_Button.initButton(&tft, 55, 195, 130, 40, 0x463f, WHITE, 0x463f, " Sensor 2",2 );
Sensor2_Button.drawButton(true);
Sensor3_Button.initButton(&tft, 260, 140, 130, 40, 0x463f, WHITE, 0x463f, "Sensor 3",2 );
Sensor3_Button.drawButton(true);
Sensor4_Button.initButton(&tft, 260, 195, 130, 40, 0x463f, WHITE, 0x463f, "Sensor 4",2 );
Sensor4_Button.drawButton(true);
}
void loop() {
}
////////////////////////////////////////////////////////////////////////////////////
// /*
// ESP32-S3 + ILI9341 TFT LCD Example
// https://wokwi.com/projects/343784047735997012
// */
// #include "SPI.h"
// #include "Adafruit_GFX.h"
// #include "Adafruit_ILI9341.h"
// #define TFT_DC 2
// #define TFT_CS 15
// Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// void setup() {
// Serial.begin(115200);
// Serial.println("Welcome to Wokwi, ESP32-S3");
// Wire.begin(10,8);
// tft.begin();
// tft.setCursor(44, 120);
// tft.setTextColor(ILI9341_RED);
// tft.setTextSize(3);
// tft.println("ESP32-S3");
// }
// const uint32_t colors[] = {
// ILI9341_GREEN,
// ILI9341_CYAN,
// ILI9341_MAGENTA,
// ILI9341_YELLOW,
// };
// uint8_t colorIndex = 0;
// void loop() {
// tft.setTextSize(2);
// tft.setCursor(26, 164);
// tft.setTextColor(colors[colorIndex++ % 4]);
// tft.println("Welcome to Wokwi!");
// delay(250);
// }