{"id":25951036,"url":"https://github.com/chinmay-esp/microros_sub-led","last_synced_at":"2026-05-06T13:05:04.917Z","repository":{"id":280615218,"uuid":"941117612","full_name":"Chinmay-ESP/MicroROS_Sub-LED","owner":"Chinmay-ESP","description":"This project demonstrates how to control an LED using ROS2 Humble and Micro-ROS on an ESP32. The ESP32 subscribes to the led_control topic and toggles the LED state based on received messages. Ideal for learning ROS2 integration with embedded systems. 🚀🔌","archived":false,"fork":false,"pushed_at":"2025-03-04T10:41:08.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T11:35:55.300Z","etag":null,"topics":["cpp","esp32","microros","platformio","ros-subscriber","ros2-humble"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chinmay-ESP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-01T14:31:32.000Z","updated_at":"2025-03-04T10:43:13.000Z","dependencies_parsed_at":"2025-03-04T11:46:28.450Z","dependency_job_id":null,"html_url":"https://github.com/Chinmay-ESP/MicroROS_Sub-LED","commit_stats":null,"previous_names":["chinmay-esp/microros_sub-led"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chinmay-ESP%2FMicroROS_Sub-LED","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chinmay-ESP%2FMicroROS_Sub-LED/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chinmay-ESP%2FMicroROS_Sub-LED/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chinmay-ESP%2FMicroROS_Sub-LED/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chinmay-ESP","download_url":"https://codeload.github.com/Chinmay-ESP/MicroROS_Sub-LED/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241855296,"owners_count":20031586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","esp32","microros","platformio","ros-subscriber","ros2-humble"],"created_at":"2025-03-04T13:30:31.283Z","updated_at":"2026-05-06T13:04:59.875Z","avatar_url":"https://github.com/Chinmay-ESP.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LED Control via ROS2 (Micro-ROS with ESP32)\n\n## Overview\nThis project demonstrates how to control an LED on an ESP32 using ROS2 (Micro-ROS). The ESP32 acts as a ROS2 node that subscribes to an `Int32` message from the topic `led_control`. The received integer value (0 or 1) determines the LED state.\n\n## Hardware Requirements\n- ESP32 Development Board\n- LED (Optional, if using an external LED)\n- USB Cable for programming\n\n## Software Requirements\n- PlatformIO\n- Micro-ROS library\n- ROS2 installed on a PC\n\n## Code Explanation\n- The ESP32 subscribes to the `led_control` topic.\n- When a message is received, it controls the LED state based on the received value.\n- Uses Micro-ROS for communication between ESP32 and ROS2.\n\n## Setup Instructions\n1. **Install Micro-ROS**:\n   - Follow the official Micro-ROS documentation to set up the environment for ESP32.\n   - Install the required dependencies for Arduino or PlatformIO.\n\n2. **Upload the Code**:\n   - Connect the ESP32 to your PC.\n   - Compile and upload the code using PlatformIO or Arduino IDE.\n\n3. **Run ROS2 Publisher**:\n   - Ensure ROS2 is installed on your PC.\n   - Run the following command to publish LED state messages:\n     ```bash\n     ros2 topic pub /led_control std_msgs/msg/Int32 \"{data: 1}\"\n     ```\n     - Send `1` to turn the LED ON.\n     - Send `0` to turn the LED OFF.\n\n4. **Monitor Serial Output**:\n   - Open the Serial Monitor at 115200 baud rate to observe received messages.\n\n## Function Breakdown\n- **`setup()`**:\n  - Initializes the serial communication.\n  - Configures the LED pin as an output.\n  - Sets up Micro-ROS, creates a node, and subscribes to the `led_control` topic.\n\n- **`subscription_callback()`**:\n  - Receives an integer value from ROS2.\n  - Controls the LED state accordingly.\n  - Prints the received data to the Serial Monitor.\n\n- **`loop()`**:\n  - Executes the Micro-ROS executor to handle incoming messages.\n\n## Notes\n- Ensure ROS2 is properly configured on your PC before running the publisher.\n- Modify the `LED_PIN` macro if using a different GPIO for the LED.\n\n## References\n- [Micro-ROS Documentation](https://micro.ros.org/)\n- [ROS-2(Humble) Documentation](https://docs.ros.org/en/humble/index.html)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinmay-esp%2Fmicroros_sub-led","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinmay-esp%2Fmicroros_sub-led","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinmay-esp%2Fmicroros_sub-led/lists"}