An object-oriented library for digilent hardware written in python 3
Project description
Py Digilent
This repository contains an object oriented library for Digilent devices. It is written in Python 3 and has typing information. Typing means this library incompatible with earlier python versions.
This library has been developed and tested with the Digilent Analog Discovery 2. The library is written to support any digilent device supported by the digilent SDK. Class properties are generated at runtime based upon the connected hardware.
Installation
Via pip:
pip install pydigilent
Samples
Blinkity blink
from pydigilent import *
import time
ad2 = AnalogDiscovery2()
while True:
ad2.io.D0.value = not ad2.io.D0.value
time.sleep(2)
Power control
from pydigilent import *
import time
ad2 = AnalogDiscovery2()
v = 3.5
ad2.power.vplus.enable = 1
ad2.power.vplus.voltage = v
# after configuring power options, the master must be switched to enable
ad2.power.master.enable = 1
ad2.scope.channel1.vertical_division = 1.
while ad2.scope.channel1.voltage < v:
print(ad2.scope.channel1.voltage)
time.sleep(.5)
print(ad2.scope.channel1.voltage)
Scope
from pydigilent import *
import time
ad2 = AnalogDiscovery2()
# D0 and D8 are connected to scope channels 1 and 2 respectively
ad2.io.D0.value = 1
ad2.io.D8.value = 1
ad2.scope.channel1.vertical_division = .2
ad2.scope.horizontal_division = .0001
ad2.scope.channel1.offset = 3.
ad2.scope.channel2.offset = 2.5
ad2.scope.acquire()
while not ad2.scope.acquire_complete():
time.sleep(.1)
# show calls plt.show (displays in a separate window)
ad2.plot(ad2.scope.data, show=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydigilent-0.0.4.tar.gz
(14.6 kB
view details)
Built Distribution
File details
Details for the file pydigilent-0.0.4.tar.gz
.
File metadata
- Download URL: pydigilent-0.0.4.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abb6e3567e21507d77657272838e24a82d3c9d86f3a69ccdbb2dc9be10a1f372 |
|
MD5 | 5fbb81e56ef30c521fcc71f5dd0275ba |
|
BLAKE2b-256 | 988c66fee03c9dda442a0e6a183c64e4a7cb887c83fcb0ecbc459581b8453cb8 |
File details
Details for the file pydigilent-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: pydigilent-0.0.4-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c95b6073ae5fd57a6e47727f91bb7752f86eff8a544d98e0878e6c1e96328f5e |
|
MD5 | 1d923e2cfe5ee8abe412e042a1b012b0 |
|
BLAKE2b-256 | a956f65b8e15106f45a3dab7e5badabf8f9364e0b21a7618a7e1b6f6be1822e1 |