Skip to main content

Python module to read values from Cleware USB-ADC 2

Project description

Description

An unofficial Python interface for the Cleware USB-ADC 2 utilizing cython-hidapi.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

License

clewareADC is provided under the MIT license (see LICENSE).

Install

  1. Download clewareADC:

    git clone https://github.com/d4rkforce/clewareADC.git
    cd clewareADC
  2. Install using setuptools:

    python setup.py install

Usage

The folowing code will list all connected USB-ADC 2 devices, connect to the first device it finds and print ten values from both channels, scaled by 13.621V:

import time
from clewareADC import ClewareADC

deviceList = ClewareADC.listDevices()
if len(deviceList) < 1:
    raise Exception('No ADCs found')

for device in deviceList:
    print('Found ADC at {} with serial number {}'.format(device[0], device[1]))
print('')

with ClewareADC(13.621, deviceList[0][1]) as adc:
    print('Reading from ADC {} with 13.621V scaling:'.format(deviceList[0][1]))

    for i in range(10):
        ch0 = adc.readChannel(0)
        ch1 = adc.readChannel(1)
        print('  Ch 0: {}V, Ch 1: {}V'.format(ch0, ch1))
        time.sleep(1.00)

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

clewareADC-0.1.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file clewareADC-0.1.tar.gz.

File metadata

  • Download URL: clewareADC-0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for clewareADC-0.1.tar.gz
Algorithm Hash digest
SHA256 6caee75da03f692d1bc0ed0755301823d07970169f30bb2321937066412512d8
MD5 5212b605380ec88a4a5b075c8ff002dd
BLAKE2b-256 001e4cc61aefc7b44deaea569abe26d1592401d49c957d7adf43be082d9c39dc

See more details on using hashes here.

Supported by

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