Skip to main content

Python driver for MCP2221/A

Build PyPI

Examples

Read GP0

from MCP2221 import MCP2221

mcp2221 = MCP2221.MCP2221()
mcp2221.InitGP(0, MCP2221.TYPE.INPUT)
print(mcp2221.ReadGP(0))

Write GP0

from MCP2221 import MCP2221

mcp2221 = MCP2221.MCP2221()
mcp2221.InitGP(0, MCP2221.TYPE.OUTPUT)
print(mcp2221.WriteGP(0, 1))

Read ADC on GP1

from MCP2221 import MCP2221

mcp2221 = MCP2221.MCP2221()
mcp2221.InitGP(1, MCP2221.TYPE.ADC)
mcp2221.SetADCVoltageReference(MCP2221.VRM.VDD)
print(mcp2221.ReadADC(1))

Write DAC on GP2

from MCP2221 import MCP2221

mcp2221 = MCP2221.MCP2221()
mcp2221.InitGP(2, MCP2221.TYPE.DAC)
mcp2221.SetDACVoltageReference(MCP2221.VRM.REF_2_048V)
mcp2221.WriteDAC(12)

Tests

pip install pytest pytest-cov
pytest tests/ --doctest-modules --cov=MCP2221

Release files for mcp2221 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp2221 1.1.0
File Size Uploaded
mcp2221-1.1.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp2221 1.1.0
File Interpreter ABI Platform
mcp2221-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / mcp2221-1.1.0.tar.gz

Download URL mcp2221-1.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
78d1be8c4396ebbfeb2bd66eb78e7fc69600af1e292e859891a42e60ab8b756d
BLAKE2b-256 checksum
How to use checksums
06616f652162588212fc8fd1a7aae9320b9133f1c773a0e1a6e50dc4c3310504
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / mcp2221-1.1.0-py3-none-any.whl

Download URL mcp2221-1.1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bef9d946857c232ab7d30a1079c2bf9c092857a926bf31d658963c7e2ef03ab
BLAKE2b-256 checksum
How to use checksums
47612cf8bbee6ebbf4575c69f611f0026d4a93a6c3af9881d808054029e08d36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page