#include "Free_Fonts.h"
#include <TFT_eSPI.h>
#include <SPI.h> // this is needed for display
#include "spy-1.h"
#include "font.h"
// The display also uses hardware SPI, plus #9 & #10
#define TFT_CS 15
#define TFT_DC 2
#define TFT_MOSI 23
#define TFT_SCLK 18
#define open_button 5
#define BLUE_REC 0x251F
float dispTemp = 22.3;
bool state;
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library with default width and height
TFT_eSprite img = TFT_eSprite(&tft);
void setup(void)
{
Serial.begin(115200);
tft.begin();
tft.setRotation(0);
// Fill screen and setSwapBytes
tft.fillScreen(TFT_BLACK);
tft.setSwapBytes(true);
// Spy Image
tft.pushImage(0,0,240,240,spy);
pinMode(5, INPUT_PULLUP);
}
void loop()
{
if(digitalRead(open_button)==LOW)
{
state=!state;
}
if(state)
{
capture();
}
else
{
clear();
}
Serial.println(state);
}
void capture()
{
tft.pushImage(0,0,240,240,spy);
}
void clear()
{
tft.fillScreen(TFT_BLACK);
}
Loading
ili9341-cap-touch
ili9341-cap-touch