The iconic bouncing logo — now on embedded hardware. Colour changes on every wall hit, smooth float-precision physics at ~83 fps.
write me the classic DVD screensaver — bouncing logo that changes colour every time it hits a wall. run it on the LCD
Simple enough — bouncing rounded rectangle with "DVD" text, float-precision position so motion stays smooth across frame rates. The classic behaviour:
(1.7, 1.3) — irrational ratio so it never loops back exactlyWriting sketches/dvd_screensaver/dvd_screensaver.ino…
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.
| Colour | RGB565 | Hex |
|---|---|---|
| Red | 0xF800 | #FF0000 |
| Green | 0x07E0 | #00FF00 |
| Blue | 0x001F | #0000FF |
| Yellow | 0xFFE0 | #FFFF00 |
| Cyan | 0x07FF | #00FFFF |
| Magenta | 0xF81F | #FF00FF |
| Orange | 0xFD20 | #FF6400 |
| White | 0xFFFF | #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
write the flash script and run it
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...
| File | What it does |
|---|---|
sketches/dvd_screensaver/dvd_screensaver.ino | Bouncing DVD logo, 8-colour palette, float-precision physics |
flash-sketch-002-dvd-screensaver.sh | Full compile + flash automation |