updated some test scripts

master
Ondřej Hruška 7 years ago
parent 91a8269e98
commit c15658e6ad
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 9
      test_adc.py
  2. 15
      test_adc2.py
  3. 13
      test_dac.py

@ -14,21 +14,24 @@ with gex.Client(gex.TrxRawUSB()) as client:
print(adc.get_channels())
adc.set_active_channels([1])
rate=500
rate=50000
fs = adc.set_sample_rate(rate)
count = 2000
time.sleep(0.1)
count = 5000
data = adc.capture(count)
print("rx, %d samples" % len(data))
data = np.add(data / 4096, -0.5)
adc.set_sample_rate(1000)
#
if data is not None:
# wavfile.write('file.wav', rate, data)
# print("Ok")
plt.plot(data, 'r.', lw=1)
plt.plot(data, 'r-', lw=1)
plt.show()
else:
print("Nothing rx")

@ -0,0 +1,15 @@
#!/bin/env python3
import time
import gex
import numpy as np
from matplotlib import pyplot as plt
from scipy.io import wavfile
with gex.Client(gex.TrxRawUSB()) as client:
adc = gex.ADC(client, 'adc')
for i in range(1000):
print(adc.read_raw())

@ -24,11 +24,14 @@ with gex.Client(gex.TrxRawUSB()) as client:
# #
# dac.sync()
for i in range(0, 1000):
dac.set_frequency(1, i)
time.sleep(0.001)
# for i in range(0, 1000):
# dac.set_frequency(1, i)
# time.sleep(0.001)
dac.waveform(1, 'SIN')
dac.set_frequency(1, 1000)
time.sleep(2)
dac.dc(1, 2047)
# dac.waveform(1, 'SIN')
# # dac.set_frequency(1, 1000)

Loading…
Cancel
Save