Using Multiple channels of AOUT simultaneously¶
In the example, we are going to output a square waveform on CH0 and complement of it on CH1. (2 Channels)
The frequency of the square waveform will be 783 $Hz$.
In [ ]:
import box0
import numpy as np
import time
# Get all the resources
dev = box0.usb.open_supported()
aout = dev.aout()
# Prepare for snapshot mode
aout.snapshot_prepare()
aout.bitsize_speed_set(12, 783 * 2) # 783KS/s per channel at 12bit
aout.chan_seq_set([0, 1])
# we are going to use both channel at once.
# in that case, the sampling frequency become half since the resource are shared
# replace "1" with the voltage you want.
y = np.array([0,1, 1,0], dtype=np.float) # (square wave) when CH0 and CH1 are complement
aout.snapshot_start(y)
# wait for the user to ask for exit
try:
while True:
time.sleep(0.1)
except KeyboardInterrupt:
pass
# Return all the resources
aout.snapshot_stop()
aout.close()
dev.close()