Ardunio

 

Marked On board Description Arduino UNO  Arduino Mega ESP32 Raspberry Pi
1-RST Reset 8   GPIO 17 (D17) GPIO 25 (22)
2-CS Chip Select 10   GPIO 15 (D15) CEO 0 GPIO 8 (24)
3-D/C DC A0 9   GPIO 16 (D16) GPIO 24  (18)
4-DIN MOSI,SDA 11   GPIO 23 (D23) GPIO 10 (19)
5-CLK SLK,SCLK 13   GPIO 18 (D18) GPIO 11 (23)
6-VCC 5v       (1)
7-BL Backlight        
8-GND Ground       (6)

 

/*
 * Rui Santos 
 * Complete Project Details https://randomnerdtutorials.com
 */

// include TFT and SPI libraries
#include <TFT.h>  
#include <SPI.h>

// pin definition for Arduino UNO
#define cs   10
#define dc   9
#define rst  8


// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);

void setup() {

  //initialize the library
  TFTscreen.begin();

  // clear the screen with a black background
  TFTscreen.background(0, 0, 0);
  //set the text size
  TFTscreen.setTextSize(2);
  }

void loop() {

  //generate a random color
  int redRandom = random(0, 255);
  int greenRandom = random (0, 255);
  int blueRandom = random (0, 255);
  
  // set a random font color
  TFTscreen.stroke(redRandom, greenRandom, blueRandom);
  
  // print Hello, World! in the middle of the screen
  TFTscreen.text("Hello, World!", 6, 57);
  
  // wait 200 miliseconds until change to next color
  delay(200);
}