Skip to main content

Library to control the CAROA04 CAN-IO expander device from eletechsup.

Project description

https://img.shields.io/pypi/v/caroa04.svg Python versions See Build Status on GitHub Actions Documentation Status

Library to control the CAROA04 CAN-IO expander device from eletechsup.

Installation

You can install “caroa04” via pip from PyPI:

$ pip install caroao4

Usage

from caroa04 import CaroA04

caro = CaroA04()
caro.start(0xE0, 'pcan', 250000, 'PCAN_USBBUS1')  # start communication

caro.do1.phys = True  # set do1 state to True
print(caro.do1.phys)  # read do1 state
print(caro.di1.phys)  # read di1 state

print(caro.bitrate.phys)  # read current bitrate
caro.bitrate.phys = 500000  # set different baudrate (will require device power cycle)

print(caro.node_id.phys)  # read current address code
caro.node_id.phys = 0xE1  # set address code (will require device power cycle)

caro.shutdown()  # free the bus

Features

  • This library uses the python-can library to communicate with the device.

  • The device has 4 digital outputs and 4 digital inputs. Hence the signals can be read/written by using the attributes of the CaroA04 class:
    • do1, do2, do3, do4 : digital output 1 to digital output 4

    • di1, di2, di3, di4 : digital input 1 to digital input 4

    • bitrate, node_id : bitrate and address code of the device

  • Each signal has a raw value and a physical value. For example, the device does not understand a bitrate in bps. It expects an enumeration that it will interpret. So it can either be set by writing its physical value (bitrate.phys = 250000) or by writing its raw value (bitrate.raw) as follows:
    • 0: 5 kbps

    • 1: 10 kbps

    • 2: 20 kbps

    • 3: 50 kbps

    • 4: 100 kbps

    • 5: 120 kbps

    • 6: 200 kbps

    • 7: 250 kbps

    • 8: 400 kbps

    • 9: 500 kbps

    • 10: 800 kbps

    • 11: 1000 kbps

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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

caroa04-0.1.2.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

caroa04-0.1.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file caroa04-0.1.2.tar.gz.

File metadata

  • Download URL: caroa04-0.1.2.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for caroa04-0.1.2.tar.gz
Algorithm Hash digest
SHA256 abb116fd78c538fddb7f386a24a14b780702fba4ece047cecf9e004be0d7c6c0
MD5 ab2576ea6d4d0b15017cf6e63b4a20e9
BLAKE2b-256 7827cc23d22ef07ed91934ca49bddc27034e3f83a6b5b2a015a8f0015e4b4156

See more details on using hashes here.

File details

Details for the file caroa04-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: caroa04-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for caroa04-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a554a71ab4bf49eaf758968994512a4fc5b1695c2842645cb64e13364fbde11e
MD5 3eb70241cf004a54479d6c7b1699d30e
BLAKE2b-256 bf668ba33210024372e9805b97b151f3c5f740288c079a223ff2248dbc3455cf

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