Untitled

Anonymous
Plain Text
09/24/2026 1:45 PM
754 B
8
Indexable
Never
#include <Arduino.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>

// =====================================================
// ST7789 240x240
// =====================================================

#define TFT_CS    -1
#define TFT_RST   4
#define TFT_DC    2
#define TFT_SCLK  18
#define TFT_MOSI  23

Adafruit_ST7789 tft(
  TFT_CS,
  TFT_DC,
  TFT_RST
);

void setup()
{
  SPI.begin(
    TFT_SCLK,
    -1,
    TFT_MOSI,
    -1
  );

  tft.init(
    240,
    240,
    SPI_MODE3
  );

  tft.setRotation(1);

  tft.fillScreen(ST77XX_BLACK);

  // Text
  tft.setTextColor(ST77XX_CYAN);
  tft.setTextSize(3);

  tft.setCursor(35, 105);
  tft.print("Hello");

  tft.setCursor(25, 140);
  tft.print("IoTNestBD");
}

void loop()
{
}
Editor is loading...
Leave a Comment