This project simulates a virtual relay and bulb system, controllable via HTTP requests in real-time. It integrates WebSockets for instant status updates, a PHP server for command processing, and a C-based virtual controller for simulation.
- Real-time control and status updates using WebSockets
- PHP server processes commands (
ON
/OFF
) via HTTP. - Exposes the server to the internet using ngrok.
- Automates setup with shell scripts.
- Place all files in a single directory.
composer install
gcc virtual_controller.c -o virtual_controller
php server.php
- Starts the WebSocket server for real-time updates.
./run_server.sh
- The PHP server and ngrok will start.
ngrok http 8080
- Use the provided public URL for external access.
./run_system.sh
- Starts the virtual controller in sync with the server.
- Use the ngrok public URL to send commands:
https://<your-ngrok-url>/controller.php?cmd=ON
https://<your-ngrok-url>/controller.php?cmd=OFF
- Check the output in the terminal for relay and bulb states.
This project simulates a virtual relay and bulb system that you control via HTTP requests. It integrates a PHP server, a C-based virtual controller, and uses ngrok for external accessibility. It's lightweight, cost-free, and sets the foundation for more advanced projects like integration or hardware control. 🚀 With everything automated through scripts, you can focus on experimenting and building new features. This project is perfect for learning system integration and handling real-time commands.