
Ever since I was a kid, I remember asking my maternal/paternal aunt and my own mom for some gadgets that had gone wrong and if I could open it up and see what was inside. I remember my dad working in telecommunication company PTCL locally and we used to have a lot of telephone headsets home. The joy of opening one, taking the magnet out and realizing the big pastic body was nothing but a facade and all that mattered and lived inside was a tiny circuit, some wires, and a membrane numberpad for dialing.
So, yesterday, after a long time of wishing and lusitng over some electronic circuits over on Ali Express, I finally got my hands on one. It is an ESP32S microcontroller with a display panel. Tiny, yet quite capable. To my surprise, I was not aware that I was gonna need to learn more C or brush up even the 2 courses I took back in my college days.
For anyone reading and mainly for my own understanding I am gonna run through the setup on this and how did I figure out what worked:
#include <Arduino.h>#include <Arduino_GFX_Library.h>constexpr uint8_t TFT_BL = 14;Arduino_DataBus *bus = new Arduino_ESP32SPI( 11, // DC 10, // CS 12, // SCK 13, // MOSI GFX_NOT_DEFINED // MISO (unused));Arduino_GFX *gfx = new Arduino_ST7789( bus, 1, // RST 1, // Rotation: landscape true, // IPS 170, // Native width 320, // Native height 35, 0, // Column / row offsets 1 35, 0 // Column / row offsets 2);void setup(){ pinMode(TFT_BL, OUTPUT); digitalWrite(TFT_BL, HIGH); gfx->begin(); // Clear the entire screen to black gfx->fillScreen(RGB565_BLACK); gfx->setTextColor(0xFFFF); gfx->setTextSize(2); gfx->setTextWrap(false); gfx->setCursor(100, 75); gfx->println("Hello World!"); }void loop(){}
Leave a comment