Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
# using openEMSstim via python
This is a collection of python examples of how to interface with openEMSstim (via USB):
1. **pyEMS**: is the python module that you need to send commands to openEMSstim
1. **openEMSstim.py**: is the main module, allows to connect to the board
2. **EMSCommand.py**: contains the function to generate EMS commands
2. **send_single_command.py**: is a simple script to send one command via USB to openEMSstim
3. pong-in-python: is an example of a simple game using EMS and Python
4. more-detailed-python-examples: has some extra things you might want to explore
5. tests: run ``python test_openems_module.py`` to check if your python module works
## How to run the python apps
1. Make sure you have python installed
2. Install our dependency by doing: pip -r requirements.txt
3. Run an app by typing ``python nameofapp.py`` (do not forget to configure serial port)
## More info about pong-in-python game
The game is simple: everytime a player looses a point (like in the image below, player left is about to loose a point) that player gets 2 seconds of EMS stimulation.

In order to alter the game, change the parameters:
1. ``self.left_player_lost_stimulation = ems_command(1,100,2000)`` [line 73]
2. ``self.right_player_lost_stimulation = ems_command(2,100,2000)``[line 74]
Or found more iteresting places of the game to trigger EMS commands, maybe to counter the players' input (if you hit the keys to move… EMS prevents you from doing so!).
### License and Liability
Please refer to the liability waiver (in documentation/liability_waiver.md).
Please refer to the license (in /license.md)
e244db203This file is pinned to the selected release. Download the original to open it in your design tool.