Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Dismiss
Join GitHub today
GitHub is home to over 40 million developers working together to host
and review code, manage projects, and build software together.
Sign up
A library for 3.5 inch RPi LCD (A) 320x480 display from Waveshare
# esp32 # arduino # ili9486 # xpt2046
Waveshare RPi 3.5.jpg Waveshare 3.5inch PRi LCD(A) and LCD(B) 2 years ago
README.md
ESP32-TFT-Library-ILI9486
A library for 3.5 inch RPi LCD (A) 320x480 display from Waveshare, for LCD (B) comment line 61 and uncomment line 62
in tft.cpp
Create new fonts with MikroElektronika GLCD Font Creator and insert the new font in fonts.h
You can also display bitmaps, touchpadcontroller XPT2046 is included
Examplecodes:
#include "Arduino.h"
#include "SPI.h"
#include "tft.h"
TFT tft;
//-------------------------------------------------------------------------------------
void setup() {
SPI.begin();
tft.begin();
tft.setRotation(1); //landscape
tft.fillScreen(TFT_BLACK);
tft.setFont(Garamond34x42);
tft.setTextColor(TFT_CYAN);
tft.setCursor(20,30);
tft.print("Hello World!");
}
//-------------------------------------------------------------------------------------
void loop(void) {
for(uint8_t rotation=0; rotation<4; rotation++) {
tft.setRotation(rotation);
tft.fillScreen(TFT_BLACK);
tft.setCursor(20,30);
tft.print("Hello World!");
delay(3000);
}
}
//-------------------------------------------------------------------------------------
Display a bitmap or jpg file, thanks to Bodmer for his great work - JPEG Decoder Library
https://github.com/Bodmer/JPEGDecoder
#include "Arduino.h"
#include "SPI.h"
#include "SD.h"
#include "FS.h"
#include "tft.h"
TFT tft;
void setup() {
SPI.begin();
tft.begin();
SD.begin();
//SD.begin(5,SPI,16000000); // faster speed
}
//-------------------------------------------------------------------------------------
void loop(void) {
tft.setRotation(0); //portait
tft.drawBmpFile(SD, "/wall_e.bmp", 0, 0);
delay(2000);
tft.setRotation(3); //landscape
tft.drawJpgFile(SD,"/wallpaper1.jpg", 0,0);
delay(2000);
tft.drawJpgFile(SD,"/arduino.jpg", 100,50);
delay(2000);
}
//-------------------------------------------------------------------------------------
Use the touchpad
#include "Arduino.h"
#include "SPI.h"
#include "tft.h"
#define TP_IRQ 39
#define TP_CS 16
TFT tft;
TP tp(TP_CS, TP_IRQ);
void setup() {
SPI.begin();
tft.begin();
// SD.begin();
tft.setRotation(1); // Use landscape format
tp.setRotation(1);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_GREENYELLOW);
tft.setTextSize(2);
}
//-------------------------------------------------------------------------------------
void loop(void) {
tp.loop();
}
//-------------------------------------------------------------------------------------