Esempio n. 1
0
daq.read_adc()

period = 0.05

# Initiate plot:
fig = plt.figure()
plt.ion()
plt.show()

# initiate lists
t = []
data = []

for i in range(50):
    try:
        daq.set_analog(i / 50.0 + .5)  # we will plot a ramp line

        data.append(daq.read_analog())  # add a new point to the plot
        t.append(period * i)  # update time list

        print(i, data[i])

        plt.plot(t, data, color="blue", linewidth=2.5, linestyle="-")
        plt.draw()
        sleep(period)  # wait for next point
    except KeyboardInterrupt:
        break

plt.close()
daq.close()