Skip to content

Add WebSerial HUD and README for p5.js gesture debugger - #16

Merged
bseverns merged 1 commit into
mainfrom
codex/implement-webserial-connection-in-sketch.js
Jan 5, 2026
Merged

bseverns merged 1 commit into
mainfrom
codex/implement-webserial-connection-in-sketch.js

Conversation

@bseverns

@bseverns bseverns commented Jan 5, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Allow the p5 sketch to ingest live JSON gesture lines from hardware via WebSerial and forward them to ingestSerialLine(line).
  • Provide a minimal teaching-friendly UI so instructors can point at a Connect Serial button and show the serial handshake/status.
  • Document exact browser and serving requirements so users can reliably connect from the browser.
  • Keep keyboard shortcuts working so the demo still runs without hardware.

Description

  • Implemented WebSerial helpers and a small HUD in software/p5js/sketch.js including setupSerialHud(), connectSerial(), startSerialReadLoop(), disconnectSerial(), and related state variables.
  • The read loop decodes the serial text stream, splits on newlines, trims lines, and calls ingestSerialLine(trimmedLine) for each full line.
  • HUD includes a Connect Serial button, status span, feature detection for navigator.serial, and graceful disconnect/read-error handling.
  • Added software/p5js/README.md describing browser requirements, exact local-server steps (python3 -m http.server 8000), connection flow, and the keyboard fallbacks.

Testing

  • Started a local HTTP server with python3 -m http.server 8000 to confirm the sketch and README are serveable, which succeeded.
  • Attempted an automated headless-browser screenshot using Playwright to smoke-test the page, but Chromium failed to launch in this environment so the capture did not complete.
  • No unit tests exist for the sketch; keyboard-triggered gestures (e.g. P, S, B, R) were intentionally left unchanged for manual/demo testing.

Codex Task

@bseverns
bseverns merged commit ca619cb into main Jan 5, 2026
8 checks passed
@bseverns
bseverns deleted the codex/implement-webserial-connection-in-sketch.js branch January 5, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant