Python library for connecting with Nextech force gauges over USB Serial
Project description
nexgraphpy module
Nexgraph Python
Description:
NexGraph Python is a Python library implementation of the NexGraph software which works with Nextech brand force gauges. It provides an easy way to connect to Nextech force gauges using Python. Despite it's name it does not create graphs as of yet, but does retrieve data from the data to be graphed.
This library is under development and more features will be added later.
Requirements:
Tested on Python versions 3.10+
Installation:
pip install nexgraphpy
Examples:
Import the library:
from nexgraph import NexGraph
Create a new instance:
dft_force_gauge = NexGraph()
Find and connect to a Nextech force gauge over USB serial port:
if dft_force_gauge.find():
if dft_force_gauge.connect():
print(dft_force_gauge.get_info())
dft_force_gauge.disconnect()
dft_force_gauge = None
else:
print("Unable to connect")
exit()
else:
print("No device found.")
exit()
Connect to a Nextech force gauge directly:
dft_force_gauge.device_path = "COM3"
if dft_force_gauge.connect():
print(dft_force_gauge.get_info())
dft_force_gauge.disconnect()
dft_force_gauge = None
else:
print("Unable to connect")
exit()
Basic device serial operations:
Returns boolean value
# Change device modes, peak and tracking
dft_force_gauge.mode()
# Change the units on device
dft_force_gauge.unit()
# Reset the current device value
dft_force_gauge.reset()
# Zero (Tare) the value on device
dft_force_gauge.zero()
Returns string value
# Download data from device memory
dft_force_gauge.download()
# Print current value
dft_force_gauge.print_value()
# Print peak compression value
dft_force_gauge.peak_compression()
# Print peak tension value
dft_force_gauge.peak_tension()
# Print different formatted outputs
dft_force_gauge.long_output()
dft_force_gauge.short_output()
dft_force_gauge.mini_output()
Output live data of 1000 rows:
Note: The output rate is roughly 10 data points per second. 100 data points is approximately 10 seconds of testing.
i = 0
while True:
print(dft_force_gauge.long_output())
i += 1
if i >= 100:
break
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
Built Distribution
File details
Details for the file nexgraphpy-1.0.0.tar.gz
.
File metadata
- Download URL: nexgraphpy-1.0.0.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8c7073b90b3659137b8f005862a0ad1967bcf04f151a446271808da60ff2753 |
|
MD5 | 8f1e3eabbf770cfba79a7aeb0bb4d4b1 |
|
BLAKE2b-256 | 8baa039c003679dd9e3946fa8e001829bc24a81a31cc07ff323b5dfc076b1292 |
File details
Details for the file nexgraphpy-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: nexgraphpy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83ceabc32732beb204eb05e92f9a5da19dddd4abd78f4e59ddda48a182880e64 |
|
MD5 | 3fcae8c3f63317d600c1b2455f1411eb |
|
BLAKE2b-256 | 5a1f9953d44e2230fa28585f7a20294f36e205d8603d7a936605532f1216d135 |