Skip to main content

Python API for controlling modular electronics, MODI+.

Project description

Python Versions PyPI Release (latest by date) Read the Docs (version) GitHub Workflow Status (Build) GitHub LICENSE Lines of Code

Description

Python API for controlling modular electronics, MODI+.

Features

PyMODI+ provides a control of modular electronics.

  • Platform agnostic control of modules through serial connection
  • Utilities of wireless connection with BLE (Bluetooth Low Engery)

Build Status

master develop
GitHub Workflow Status GitHub Workflow Status

System Support

System 3.7 3.8 3.9 3.10 3.11
Linux GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub Workflow Status (branch)
Mac OS GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub Workflow Status (branch)
Windows GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub Workflow Status (branch)

Contribution Guidelines

We appreciate all contributions. If you are planning to report bugs, please do so here. 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.

Contributor Covenant

Installation

When 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 install Anaconda, 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 --version

Install the latest PyMODI+ if you haven't installed it yet:

python -m pip install pymodi-plus --user --upgrade

Usage

Import modi_plus package and create MODIPlus object (we call it "bundle", a bundle of MODI+ modules).

# Import modi_plus package
import modi_plus

"""
Create MODIPlus object, make sure that you have connected your network module
to 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 method
bundle = 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 modules
print(bundle.modules)

# List connected leds
print(bundle.leds)

# Pick the first led object from the bundle
led = bundle.leds[0]

Let's blink the LED 5 times.

import time

for _ in range(5):
    # turn on for 0.5 second
    led.turn_on()
    time.sleep(0.5)

    # turn off for 0.5 second
    led.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 --tutorial

As well as an interactive usage examples:

$ python -m modi_plus --usage

Additional Usage

To diagnose MODI+ modules (helpful to find existing malfunctioning modules),

$ python -m modi_plus --inspect

To initialize MODI+ modules implicitly (set i flag to enable REPL mode),

$ python -im modi_plus --initialize

To see what other commands are available,

$ python -m modi_plus --help

History

0.0.1 (2022-11-15)

  • Release initial version of the package on in-house GitHub

0.0.2 (2022-11-18)

  • Feature
  1. Change python minimum version to 3.9

0.1.0 (2022-11-22)

  • Feature
  1. Add creation examples (brush, dodge)
  2. Add network, battery module functions
  3. Fix play_music function on speaker module
  4. Add preset resource on speaker and display module
  5. Add search module time and timeout exception

0.1.1 (2022-11-23)

  • Feature
  1. Change python minimum version to 3.7

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymodi-plus-0.1.1.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

pymodi_plus-0.1.1-py2.py3-none-any.whl (1.5 MB view details)

Uploaded Python 2 Python 3

File details

Details for the file pymodi-plus-0.1.1.tar.gz.

File metadata

  • Download URL: pymodi-plus-0.1.1.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.15

File hashes

Hashes for pymodi-plus-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4867f7ddfe1385e7b1e99a5c4ed0cd6e7eb37a90466266562044deee0710a4b6
MD5 326e327a5dcc6d0fe3251866d18977b2
BLAKE2b-256 3faf4a53bb2cbdb8e4e650c4621e6d3f4d3b21450a7e7a4d0ebf66861d052de0

See more details on using hashes here.

File details

Details for the file pymodi_plus-0.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pymodi_plus-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3068e4c3126c821a4ea8b105ae40da60eafb6d6be8f6d33a4c44c6e358e59aef
MD5 003eef60161bcd3f33900e4b8f6c44bb
BLAKE2b-256 13f9be68174489f0c8b7e2b4e620d46735f58d6aa3d2b68841539ce8b78aa2cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page