SpringLoadedSwitch is a Python-based project that provides a web interface for simulating the behavior of a spring-loaded toggle switch. This project is useful for understanding the mechanics of such switches and can serve as an educational tool or a prototype for more complex simulations.
- Web Interface: Interactive web-based simulation of a spring-loaded toggle switch.
- Python Backend: Utilizes Python scripts to handle the logic and state management of the switch.
- Educational Tool: Demonstrates the principles of spring-loaded mechanisms in a user-friendly manner.
git clone https://github.com/arghyabi/SpringLoadedSwitch.gitcd SpringLoadedSwitchEnsure you have Python installed. Then, install the required packages:
pip install -r requirements.txtExecute the provided shell script to configure and install Python Server and PHP server:
./preConfig.shOpen your web browser and navigate to http://localhost:8080 to interact with the simulation.
If the Python server already installed via preConfig.sh script then turn of the running server:
sudo systemctl stop spring-loaded-switch-python.serviceIf the server is not running then this step can be skipped and directly run the following connand to run the python server locally
./runPythonServer.shIf the PHP server already installed via preConfig.sh script then turn of the running server:
sudo systemctl stop spring-loaded-switch-php.serviceIf the server is not running then this step can be skipped and directly run the following connand to run the php server locally
./runPhpServer.shSpringLoadedSwitch/
├── Script/
│ └── [Python scripts handling switch logic]
├── Web/
│ └── [HTML/CSS/JavaScript files for the web interface]
├── .gitignore
├── config.yaml
├── preConfig.sh
├── requirements.txt
├── runPhpServer.sh
└── runPythonServer.sh- Script/: Contains Python scripts that manage the switch's behavior and state.
- Web/: Includes the frontend components for the web interface.
- .gitignore: Specifies files and directories to be ignored by Git.
- config.yaml: Configuration file for setting up parameters.
- preConfig.sh: Shell script to Configure the env and install all the service file for both python and php server.
- requirements.txt: This will install all required python packages.
- runPhpServer.sh: Shell script to initiate a PHP server for hosting the web interface.
- runPythonServer.sh: Shell script to initiate a Python server to run the main logic code.