📺 ESP32-S3 · Sketch 002

Classic DVD Screensaver
on a 2.8" LCD

The iconic bouncing logo — now on embedded hardware. Colour changes on every wall hit, smooth float-precision physics at ~83 fps.

Freenove ESP32-S3 FNK0086
📺 ST7789 240×320
🎨 8-colour palette
🤖 Claude Sonnet 4.6
Session Transcript
Building the DVD Screensaver
Step 1 · Request
👤
Richard

write me the classic DVD screensaver — bouncing logo that changes colour every time it hits a wall. run it on the LCD

Claude

Simple enough — bouncing rounded rectangle with "DVD" text, float-precision position so motion stays smooth across frame rates. The classic behaviour:

  • Logo travels at velocity (1.7, 1.3) — irrational ratio so it never loops back exactly
  • On wall hit: reflect velocity and advance palette index (skip current colour)
  • Erase old position, draw new — only when pixel coords actually changed

Writing sketches/dvd_screensaver/dvd_screensaver.ino

Step 2 · Implementation Details
Claude

The logo is drawn as a filled rounded rectangle (LOGO_W=88, LOGO_H=44, r=8) with a thin inner border for depth, and "DVD" text centred in black — readable against any of the 8 palette colours.

ColourRGB565Hex
Red0xF800#FF0000
Green0x07E0#00FF00
Blue0x001F#0000FF
Yellow0xFFE0#FFFF00
Cyan0x07FF#00FFFF
Magenta0xF81F#FF00FF
Orange0xFD20#FF6400
White0xFFFF#FFFFFF

Colour picks skip the current colour ((ci + 1 + rand() % 7) % 8) so it always visually changes.

// Erase only the previous rect, draw the new one
// Only when integer pixel position changes — no flicker
if (nx != px_prev || ny != py_prev || ci != ci_prev) {
  eraseLogo(px_prev, py_prev);
  drawLogo(nx, ny, PALETTE[ci]);
}
delay(12);  // ~83 fps cap
✓ Sketch written No libraries beyond TFT_eSPI ~83 fps on ST7789
Step 3 · Flash
👤
Richard

write the flash script and run it

Claude

Wrote flash-sketch-002-dvd-screensaver.sh — same compile + flash pipeline as sketch 001. Only TFT_eSPI needed; no additional libraries.

./flash-sketch-002-dvd-screensaver.sh

# Compiling dvd_screensaver...
# Sketch uses 29% of flash, 12% of RAM
# Wrote 301056 bytes at 0x00010000 in 3.8 seconds
# Hash of data verified.
# Hard resetting via RTS pin...
✓ Compiled — 29% flash ✓ Flashed successfully DVD logo bouncing on LCD
Session Summary
Claude — What We Built
FileWhat it does
sketches/dvd_screensaver/dvd_screensaver.inoBouncing DVD logo, 8-colour palette, float-precision physics
flash-sketch-002-dvd-screensaver.shFull compile + flash automation