Cheap Yellow Display dashboard

The CYD’s own 2.8" screen on HSPI: a title bar, the uptime and a moving wave.

Cheap Yellow Display dashboard in Argynix Lab

The code

sketch.inoC++
// The Cheap Yellow Display (ESP32-2432S028R): its ILI9341 is on HSPI, with the pins the
// board's Arduino variant names (CYD_TFT_SCK, CYD_TFT_DC...). The backlight is on CYD_TFT_BL.
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>

SPIClass hspi(HSPI);
Adafruit_ILI9341 tft(&hspi, CYD_TFT_DC, CYD_TFT_CS);
int x = 0;

void setup() {
  pinMode(CYD_TFT_BL, OUTPUT);
  digitalWrite(CYD_TFT_BL, HIGH);
  hspi.begin(CYD_TFT_SCK, CYD_TFT_MISO, CYD_TFT_MOSI, CYD_TFT_CS);
  tft.begin();
  tft.setRotation(1);
  tft.fillScreen(ILI9341_BLACK);
  tft.fillRect(0, 0, 320, 30, ILI9341_DARKCYAN);
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
  tft.setCursor(8, 8);
  tft.print("CYD dashboard");
}

void loop() {
  tft.fillRect(8, 44, 200, 24, ILI9341_BLACK);
  tft.setCursor(8, 48);
  tft.setTextColor(ILI9341_YELLOW);
  tft.print("Up ");
  tft.print(millis() / 1000);
  tft.print(" s");
  // A wave drawn a column at a time, the column ahead cleared.
  int y = 160 + sin(x / 12.0) * 50;
  tft.drawFastVLine((x + 1) % 320, 100, 120, ILI9341_BLACK);
  tft.fillCircle(x, y, 2, ILI9341_GREEN);
  x = (x + 1) % 320;
  delay(20);
}