Skip to content

yazici/pymachinetalk

 
 

Repository files navigation

Machinetalk bindings for Python

PyPI version Build Status License: MIT Code style: black

This repository contains Machinetalk bindings for Python. Machinetalk is the middleware for Machinekit the open source machine control software.

For more information visit:

Examples

You can find examples how to use pymachinetalk in ./examples/

HAL Remote Quickstart

import time
from pymachinetalk.dns_sd import ServiceDiscovery
import pymachinetalk.halremote as halremote

sd = ServiceDiscovery()

rcomp = halremote.RemoteComponent('anddemo', debug=False)
rcomp.newpin('button0', halremote.HAL_BIT, halremote.HAL_OUT)
rcomp.newpin('button1', halremote.HAL_BIT, halremote.HAL_OUT)
led_pin = rcomp.newpin('led', halremote.HAL_BIT, halremote.HAL_IN)
sd.register(rcomp)

sd.start()

try:
    while True:
        if rcomp.connected:
            print('LED status %s' %s str(led_pin.value)
        time.sleep(0.5)
except KeyboardInterrupt:
    pass

sd.stop()

Install from PyPi

Pymachinetalk is available on PyPI

You can easily install it via pip:

sudo apt install python-pip
sudo pip install pymachinetalk

Install from Source

Requirements

Pymachinetalk depends on the machinetalk-protobuf, fysom, zeroconf and pyzmq Python packages.

Note that you need a recent version of fysom (> 2.0) for pymachinetalk to work properly.

On Debian based distributions you can use the following commands:

# install everything from pip
sudo apt install python-pip
pip install -e .[dev]

Install

You can install pymachinetalk using the Python setuptools:

sudo python setup.py install

TODO

  • more and easier examples
  • more testing

About

Python bindings for Machinetalk

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%