#include <SPI.h>
#include <TFT_eSPI.h>
#include "NotoSansBold15.h"
#include "CourierB24.h"
#include "Unicode_Test_72.h"
// Note: this library doesn't require further configuration
#include <XPT2046_Touchscreen.h>
// Create a TFT_eSPI instance:
TFT_eSPI tft = TFT_eSPI();
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define FONT_SIZE 1
int oldV=-1;
int v;
float v2;
void setup() {
Serial.begin(115200);
// Start the tft display
tft.init();
// Set the TFT display rotation in landscape mode, 1 will flip display 180 degrees
tft.setRotation(3);
// There are 24 predefined colors, see file TFT_eSPI.h in library folder for list of colors
// Can also create your own color by using an RGB hex number, example: 0x0C70
// Use this command to refresh screen by wiping with white or black
tft.fillScreen(0x0C70); // TFT_RED
// There are predefined fonts, see file User_Setup.h in library folder for list of fonts
// Takes up to 2 arguments: (text-color, text-bkg-color)
tft.setTextColor(TFT_BLACK);
// Takes up to 4 arguments: (string, x cord, y cord, text-size)
tft.drawString("Hello Craig", 10, 10); // defalult font used
tft.drawString("Font 1", 10, 20, 1);
tft.setTextColor(TFT_RED);
tft.drawString("Font 2", 10, 30, 2);
tft.setTextColor(TFT_YELLOW);
tft.drawString("Font 4", 10, 50, 4);
tft.drawString("1234", 10, 80, 6); // numbers only
tft.drawString("1234", 10, 120, 7); // numbers only
tft.drawString("1234", 10, 170, 8); // numbers only
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
delay(2000);
tft.fillScreen(TFT_BLACK);
//tft.setTextFont(6);
//tft.loadFont(NotoSansBold15);
//tft.loadFont(CourierB24);
tft.loadFont(Unicode_Test_72);
}
void loop() {
v = analogRead(3);
//for (int i = 0; i < 99; i++) {
if(oldV != v){
oldV = v;
v2= v/10.0;
Serial.println("New");
tft.setCursor(80,80);
tft.fillRect(80,80,180,60,TFT_BLACK);
//setTextPadding(100);
//tft.drawString(String(i), 40, 80, 8);
tft.print(v2,1);
//delay(250);
}
delay(500);
}
Loading
wemos-s2-mini
wemos-s2-mini
Loading
ili9341-cap-touch
ili9341-cap-touch