Skip to main content

Python package for Ternion microcontroller board

Project description

Pythonion

Description

Pythonion is a Python library used to interface to TernionEAI firmware running on Ternion microcontroller board. It provides a high level interface to interact with the board and its peripherals.

Note: The project is still in development and tested on Windows OS only.

Installation

Step 1

Create a new environment with the required dependencies.

python -m venv .venv.ternion

Step 2

Activate the environment.

.venv.ternion/Scripts/activate

Step 3

Install the pythonion package.

python -m pip install pythonion

Usage

Create a new script, import the pythonion package and use it as shown in the following examples.

Example 1

""" Get Firmware Info and Serial Number """

from pythonion import Ternion

ptn = Ternion()
print(f"Firmware Info: {ptn.get_firmware_info()}")
print(f"Serial Number: {ptn.get_serial_number()}")
ptn.start()

Example 2

"""
Testing:
    - Make an analog input change to see the event data
    - Press a switch to see the event data
"""

from pythonion import Ternion, TernionSwitchEventData, TernionAnalogEventData


def psw_event_callback(event: TernionSwitchEventData) -> None:
    print(f"{event.get_producer()} {event.get_state_name()} {event.get_press_count()}")


def adc_event_callback(event: TernionAnalogEventData) -> None:
    print(f"{event.get_producer()} {event.get_voltage():.3f}")


pyt = Ternion()
pyt.on_switch_event(psw_event_callback)
pyt.on_analog_event(adc_event_callback)
pyt.start()

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

pythonion-0.0.17.tar.gz (50.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythonion-0.0.17-py3-none-any.whl (56.5 kB view details)

Uploaded Python 3

File details

Details for the file pythonion-0.0.17.tar.gz.

File metadata

  • Download URL: pythonion-0.0.17.tar.gz
  • Upload date:
  • Size: 50.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pythonion-0.0.17.tar.gz
Algorithm Hash digest
SHA256 f1ff8e57dd0a5ca7b7a6656cc63132d5dc4cd515147dfa46e750c1fbd9ebdf75
MD5 80f8e2a2f86b28b42a457dd9afefcc51
BLAKE2b-256 c16eb5b01f1711ecbcfe648bd6a7cec2ab9a917feb1235a0bba04eeb6a451e18

See more details on using hashes here.

File details

Details for the file pythonion-0.0.17-py3-none-any.whl.

File metadata

  • Download URL: pythonion-0.0.17-py3-none-any.whl
  • Upload date:
  • Size: 56.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pythonion-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 2e086995dbe9e6c578bae4b51c851c300c5f614a4ba7d0fe5cb4ac675b731785
MD5 b4ef7857d3590b67c7e165397fe8612e
BLAKE2b-256 930aaa6779072a501a39ce853f9cefe155ee28028893584c582e5fcc1383f368

See more details on using hashes here.

Supported by

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