The board
Every lesson opens the board on its own: the Cheap Yellow Display, or CYD (Sunton's ESP32-2432S028R). It carries everything the course needs, so there is nothing to wire:
- a classic ESP32 with WiFi
- a 320 x 240 ILI9341 screen on SPI (MOSI 13, SCK 14, CS 15, DC 2, backlight 21), driven with TFT_eSPI
- an XPT2046 resistive touch controller on its own pins (CLK 25, DIN 32, DO 39, CS 33, IRQ 36), read with XPT2046_Touchscreen
- an RGB LED on GPIO 4, 16 and 17, each color lit LOW
Press on the board's screen with the mouse to touch it. Take the course at /learn/path/cyd-touch-apps on /learn.
The lessons
- The board tour. What is on the board and where, and the RGB LED that lights when its pin is LOW.
- Drawing shapes. Coordinates with y growing down, pixels, lines, rectangles, circles and triangles, RGB565 colors, and animation by erasing and redrawing.
- Text and fonts. The numbered fonts measured with textWidth(), the text datum, scaling, and a score that counts without flicker.
- Touch points. Raw touch readings, mapping them to pixels, the press and the lift, and what bad calibration does.
- Buttons on screen. A struct per button, a hit test, a pressed look, and buttons that set the LED's color.
- A WiFi clock. Joining WiFi, asking an NTP server, time zones, and seven-segment digits.
- Project: a space mission panel. ARM, LAUNCH and ABORT buttons driving a state machine with a safety interlock, a countdown that never blocks, and commands sent over serial.
What each sketch does
| Sketch | What it does |
|---|---|
cydtour |
Prints the board's map, says hello, cycles the RGB LED. |
cydshapes |
Draws a night launch from shapes and moves a satellite across it. |
cydtext |
Measures fonts, centers text, counts a score in font 7. |
cydtouch |
Prints each touch, raw and in pixels, and draws a crosshair. |
cydbuttons |
Three touch buttons that light the LED red, green or blue. |
cydclock |
Joins WiFi, asks NTPClient for the time, shows it big. |
cydpanel |
The mission panel: SAFE, ARMED, countdown and LIFTOFF. |
Honest limits
- Fonts. Mokxi draws TFT_eSPI's numbered fonts with its own letters scaled to about their size, so every letter is the same width. On a real board fonts 2 and 4 are proportional and measure a little differently; the course measures with textWidth() for that reason.
- Time. The network is simulated and reaches no real time server, so the WiFi clock shows the simulation's own clock: 2026-01-01 00:00:00 UTC at Run, plus the seconds since. A real board shows the real time.
- Touch. The mouse presses at one point with a fixed pressure. A real resistive screen needs calibrating, which lesson 4 explains.
- Not simulated. The CYD's light sensor, speaker output and microSD slot.
Related
CircuitPython on the Pico, another beginner embedded course.