forked from awendt/pyrelacs
38 lines
977 B
Python
38 lines
977 B
Python
import ctypes
|
|
|
|
import uldaq
|
|
from IPython import embed
|
|
from pyrelacs.repros.repos import Repos
|
|
from pyrelacs.util.logging import config_logging
|
|
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
|
|
log = config_logging()
|
|
|
|
|
|
class Output_daq(Repos):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
# devices = uldaq.get_daq_device_inventory(uldaq.InterfaceType.USB)
|
|
# self.daq_device = uldaq.DaqDevice(devices[0])
|
|
# self.daq_device.connect()
|
|
|
|
def write_daq(self):
|
|
log.debug("running repro")
|
|
time = np.arange(0, 10, 1 / 30_000.0)
|
|
data = 2 * np.sin(2 * np.pi * 1 * time)
|
|
self.send_analog_dac(
|
|
data, [0, 0], 30_000, ScanOption=uldaq.ScanOption.EXTTRIGGER
|
|
)
|
|
|
|
def trigger(self):
|
|
self.digital_trigger(1)
|
|
self.daq_device.disconnect()
|
|
self.daq_device.release()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
daq_input = Output_daq()
|
|
daq_input.write_daq()
|
|
# daq_input.trigger()
|