Package: pymodi-plus
DescriptionPython API for controlling modular electronics, MODI+.FeaturesPyMODI+ provides a control of modular electronics.Platform agnostic control of modules through serial connectionUtilities of wireless connection with BLE (Bluetooth Low Engery)Build StatusmasterdevelopSystem SupportSystem3.73.83.93.103.11LinuxMac OSWindowsContribution GuidelinesWe appreciate all contributions. If you are planning to report bugs, please do sohere. Feel free to fork our repository to your local environment, and please send us feedback by filing an issue.If you want to contribute to pymodi, be sure to review the contribution guidelines. This project adheres to pymodi's code of conduct. By participating, you are expected to uphold this code.InstallationWhen installing PyMODI+ package, we highly recommend you to use Anaconda to manage the distribution.
With Anaconda, you can use an isolated virtual environment, solely for PyMODI+.[Optional] Once you installAnaconda, then:# Install new python environment for PyMODI+ package, choose python version >= 3.7
conda create --name pymodi_plus python=3.7

# After you properly install the python environment, activate it
conda activate pymodi_plus

# Ensure that your python version is compatible with PyMODI+
python --versionInstall the latest PyMODI+ if you haven't installed it yet:python -m pip install pymodi-plus --user --upgradeUsageImport modi_plus package and create MODIPlus object (we call it "bundle", a bundle of MODI+ modules).# Import modi_plus packageimportmodi_plus"""Create MODIPlus object, make sure that you have connected your network moduleto your machine while other modules are attached to the network module"""bundle=modi_plus.MODIPlus()[Optional] Specify how you would like to establish the connection between your machine and the network module.# 1. Serial connection (via USB), it's the default connection methodbundle=modi_plus.MODIPlus(connection_type="serialport")# 2. BLE (Bluetooth Low Energy) connection, it's wireless! But it can be slow :(bundle=modi_plus.MODIPlus(conn_type="ble",network_uuid="YOUR_NETWORK_MODULE_UUID")List and create connected modules' object.# List connected modulesprint(bundle.modules)# List connected ledsprint(bundle.leds)# Pick the first led object from the bundleled=bundle.leds[0]Let's blink the LED 5 times.importtimefor_inrange(5):# turn on for 0.5 secondled.turn_on()time.sleep(0.5)# turn off for 0.5 secondled.turn_off()time.sleep(0.5)If you are still not sure how to use PyMODI, you can play PyMODI tutorial over REPL:$ python -m modi_plus --tutorialAs well as an interactive usage examples:$ python -m modi_plus --usageAdditional UsageTo diagnose MODI+ modules (helpful to find existing malfunctioning modules),$ python -m modi_plus --inspectTo initialize MODI+ modules implicitly (setiflag to enable REPL mode),$ python -im modi_plus --initializeTo see what other commands are available,$ python -m modi_plus --helpHistory0.3.0 (2023-01-19)FeatureAdddraw_dotfunction on display modulePatchFixwrite_textfunction error on display module if text length is 23Change module constructor argument from uuid to id0.2.1 (2022-12-02)PatchRefactorwrite_textinput type on display module0.2.0 (2022-12-02)FeatureRefactor getter/setter for each MODI+ module0.1.1 (2022-11-23)FeatureChange python minimum version to 3.70.1.0 (2022-11-22)FeatureAdd creation examples (brush, dodge)Add network, battery module functionsFixplay_musicfunction on speaker moduleAdd preset resource on speaker and display moduleAdd search module time and timeout exception0.0.2 (2022-11-18)FeatureChange python minimum version to 3.90.0.1 (2022-11-15)Release initial version of the package on in-house GitHub