Crates.io | instrument-ctl |
lib.rs | instrument-ctl |
version | 0.1.4 |
source | src |
created_at | 2023-08-11 17:52:32.514778 |
updated_at | 2023-08-22 15:26:53.993746 |
description | Connect to, command, and query intruments |
homepage | https://github.com/KrisNK/rs-instrument-ctl |
repository | https://github.com/KrisNK/rs-instrument-ctl |
max_upload_size | |
id | 942172 |
size | 9,994 |
Connect to, command, and query intruments such as oscilloscopes.
Currently only supports USBTMC connections.
Supported interfaces:
Considered interfaces:
Eventually, and depending on my motivation, this project will become a pure Rust VISA driver. However, in my current position this seems to be a pipe dream.
To use, add the following line to your project's Cargo.toml dependencies:
rs-instrument-ctl = "0.1"
The example below demonstrates how to connect to, send commands to and query the device.
use rs_instrument_ctl::Instrument;
const VISA_ADDRESS: &str = "USB::0x0000::0x0000::SERIALNUMBER::INSTR"
fn main() {
// connect to the instrument
let instrument = Instrument::connect(VISA_ADDRESS).expect("failed to connect to device");
// send a command
instrument.command("*IDN").expect("failed to send command");
// query the device and return the response as a string
let response: String = instrument.query("*IDN?").expect("failed to query");
// query the device and return the response as a vector of bytes
let response: Vec<u8> = instrument.query("*IDN?").expect("failed to query");
}