In [1]:
# required to make plots show up
%matplotlib inline
In [2]:
import numpy as np
import matplotlib.pyplot as plt
from labdrivers.ni import bnc2110
In [5]:
dac = bnc2110('Dev1')
# define some parameters
v_min = -10E-3
v_max = 30E-3
v_step = 1E-3
voltages = np.arange(v_min, v_max, v_step)
readings = []
for volt in voltages:
# set the DAC output
dac.setVoltageOutput('ao1', volt)
# take a measurement
data_pt = dac.readCurrentInput('ai1')
readings.append(data_pt)
# plot the results
plt.plot(voltages, readings)
plt.xlabel('Volts')
plt.ylabel('Ohms')
Out[5]: