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

Testing

Step 1

Connect the Ternion board to the computer via USB cable.

Step 2

Run the self-test command.

pythonion selftest

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 *

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 *


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.16.tar.gz (50.5 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.16-py3-none-any.whl (57.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pythonion-0.0.16.tar.gz
  • Upload date:
  • Size: 50.5 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.16.tar.gz
Algorithm Hash digest
SHA256 6d0c0e6f2149a83ccef85be773586638d572bf0047aedf6c12b0483eff97c38a
MD5 5cbd3501bbedb3150b11139f75f10747
BLAKE2b-256 9e982119ecea5b5c06f474115b8bda3b8e8b6a275617c90a25caacb2e464f881

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pythonion-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 57.4 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.16-py3-none-any.whl
Algorithm Hash digest
SHA256 2263f0499ec971ca7c51f3ea004292cfbf7d8f26ee1c7adfe4207f598bedd21e
MD5 31dae3587e147167029987ccec23cd6b
BLAKE2b-256 d7dbd25a18e38af5943503356fc5cc845dcb60426acc30d91ee78be7ecd42f3b

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