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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp2221-1.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

mcp2221-1.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file mcp2221-1.1.0.tar.gz.

File metadata

  • Download URL: mcp2221-1.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for mcp2221-1.1.0.tar.gz
Algorithm Hash digest
SHA256 78d1be8c4396ebbfeb2bd66eb78e7fc69600af1e292e859891a42e60ab8b756d
MD5 aa2c7b98fcbb013b88538bccfc794e63
BLAKE2b-256 06616f652162588212fc8fd1a7aae9320b9133f1c773a0e1a6e50dc4c3310504

See more details on using hashes here.

File details

Details for the file mcp2221-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcp2221-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for mcp2221-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bef9d946857c232ab7d30a1079c2bf9c092857a926bf31d658963c7e2ef03ab
MD5 b6bcd8d8686dd348ce51cf8fd8b6428d
BLAKE2b-256 47612cf8bbee6ebbf4575c69f611f0026d4a93a6c3af9881d808054029e08d36

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

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