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.3.tar.gz
(2.8 kB
view details)
Built Distribution
File details
Details for the file pydigilent-0.0.3.tar.gz
.
File metadata
- Download URL: pydigilent-0.0.3.tar.gz
- Upload date:
- Size: 2.8 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 | b2957c355c5a3c35fe5b272101c3e12fccf48c63ca8d4b568738d68a422821d8 |
|
MD5 | 765e05a263ce6c5ba9085f53febd37dd |
|
BLAKE2b-256 | 849c7df515d42175c35873ff5db0b9fb109dc3c47a609ab9db06305a2a6c5151 |
File details
Details for the file pydigilent-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: pydigilent-0.0.3-py3-none-any.whl
- Upload date:
- Size: 2.7 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 | 78286b35310ad478df7204866e0a5359d04269bd68128410c577dc1d800fb745 |
|
MD5 | ef52e5e993bc239c3d9868fdcc3577c8 |
|
BLAKE2b-256 | 5e36a129746ab026bf431f581775139cbb817c3d1042ad0afb68e77812c6f3aa |