Skip to content

Add ESP32 ultrasonic WebSocket example with Python control server#2

Draft
musfaagv wants to merge 1 commit into
codex/add-websocket-feature-for-esp32from
codex/task-title
Draft

Add ESP32 ultrasonic WebSocket example with Python control server#2
musfaagv wants to merge 1 commit into
codex/add-websocket-feature-for-esp32from
codex/task-title

Conversation

@musfaagv
Copy link
Copy Markdown
Owner

Motivation

  • Provide a complete example showing ESP32 ↔ Python WebSocket communication for ultrasonic telemetry and remote LED control.
  • Make it easy to test sending distance in cm and inch from an ESP32 and receiving server-initiated LED on/off commands.

Description

  • Add example_firmware/websocket_ultrasonic/server.py, an asyncio WebSocket server that accepts JSON sensor telemetry, prints cm/inch values, and broadcasts LED commands via an interactive terminal (on/off/list/help/exit).
  • Add example_firmware/websocket_ultrasonic/websocket_ultrasonic.ino, an ESP32 sketch that reads an HC-SR04, converts to cm and inch, sends JSON telemetry to the server, and applies received LED commands.
  • Extend example_firmware/README.md with protocol examples, wiring notes (HC-SR04 ECHO voltage warning), and instructions to run the server (python server.py) and upload the sketch.

Testing

  • Ran python3 -m py_compile example_firmware/websocket_ultrasonic/server.py, which completed successfully.
  • Performed repository validation steps and created the change commit (files added: server.py, websocket_ultrasonic.ino, and README updates).

Codex Task

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