コード例 #1
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
""" Example program to show how to read multiple
samples from multiple ADC channels at a given sample rate
"""

from pydaqmx_helper.adc import ADC

myADC = ADC()
myADC.addChannels([0, 1, 2])
samples = myADC.sampleVoltages(10, 10)

print("Samples for Channel 0:", samples[0])
print("Samples for Channel 1:", samples[1])
print("Samples for Channel 2:", samples[2])
コード例 #2
0
#author: Ruairí Brady ([email protected])

#importing libraries
import matplotlib.pyplot as plt
import numpy as np
from pydaqmx_helper.adc import ADC
% matplotlib inline

#data run
myADC=ADC()
myADC.addChannels([0], minRange=-10, maxRange=5)
val = myADC.sampleVoltages(1024,40)

#saving data
np.savetxt('ft_greenlaser2.txt',val[0],delimiter='')
コード例 #3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function

""" Example program to show how to read multiple
samples from multiple ADC channels at a given sample rate
"""

from pydaqmx_helper.adc import ADC

myADC = ADC()
myADC.addChannels([0, 1, 2])
sample = myADC.sampleVoltages(10, 10)
print(sample)
print('Printing just values ')
print(list(sample.values()))
コード例 #4
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
""" Read in analog signal from 1 channel and plot it
using oscilloscope, ramp or sine 2.2Hz, 1.41Vpp get good picture
Should display a nice looking sine wave plot 
"""

import numpy
import matplotlib.pyplot as plt

from pydaqmx_helper.adc import ADC

myADC = ADC()
myADC.addChannels([0])

data = list(myADC.sampleVoltages(100, 100)[0])

x = numpy.arange(100)
print(numpy.average(data))
plt.plot(x, data)
plt.show()
コード例 #5
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function

""" Example program to show how to read multiple
samples from a single ADC channel with a
user-specified range at a given sample rate
Should print out 50 samples
"""

from pydaqmx_helper.adc import ADC

myADC = ADC()
myADC.addChannels([0], ADC_mode='DAQmx_Val_Diff', minRange=-5.0,
                   maxRange=5.0)

# Returns a dictionary with voltages and channels as key value pairs.
# Here we get the values from channel 0

samples = myADC.sampleVoltages(50, 10)[0]
for sample in samples:
    print(sample)
コード例 #6
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
""" Example program to show how to read multiple
samples from a single ADC channel with a
user-specified range at a given sample rate
Should print out 50 samples
"""

from pydaqmx_helper.adc import ADC

myADC = ADC()
myADC.addChannels([0], ADC_mode='DAQmx_Val_Diff', minRange=-5.0, maxRange=5.0)

# Returns a dictionary with voltages and channels as key value pairs.
# Here we get the values from channel 0

samples = myADC.sampleVoltages(50, 10)[0]
for sample in samples:
    print(sample)
コード例 #7
0
from __future__ import print_function
"""
Example program to show how to read from a single ADC channel with default settings
Should print out the correct voltage value for channel 0
"""

from pydaqmx_helper.adc import ADC

myADC = ADC()
myADC.addChannels([0])
val = myADC.readVoltage()
print(val)