PyDAQmx icon indicating copy to clipboard operation
PyDAQmx copied to clipboard

Digital I/O

Open xakni1 opened this issue 11 years ago • 3 comments

Hello, I am currently having an issue trying to write the code for the digital input and outputs of the examples and acquire data. If you could please help that would be greatly appreciated.

xakni1 avatar Jul 15 '14 20:07 xakni1

Can you paste some code? Hard to help if we have no idea what the problem is. You can take a look at my code that uses PyDAQmx, and see if that helps. https://github.com/codedragon/pydaq

codedragon avatar Jul 15 '14 20:07 codedragon

Thanks for getting back to me, I am relatively new to Python moving from LabView and wanted to just perform some tests for DIO. I eventually want to create an active low reset for DO with a default state is high (i.e. 3.3V), goes low for a predefined duration (e.g. 500 msec) and it goes back to the high stat 3.3V. Here is what I have so far, please let me know if i am on the right track for both:

#digital input import PyDAQmx as Daq import numpy as np digital_input = Task() read = int32() data = numpy.zeros((10000,), dtype = numpy.float64) digital_input.CreateDIChan("Dev1/port0/line0", "", Daq.DAQmx_Val_ChanPerLine) digital_input.StartTask digital_input.StartTask print "Acquired %d points"%read.value

#digital output digital_output = DOTask() pulse = np.zeros(1, dtype = np.uint8) CreateDOChan("Dev1/port0/line1", "", Daq.DAQmx_Val_ChanPerLine) self.StartTask() WriteDigitalLines(1, False, Daq.DAQmx_Val_WaitInfinitely, Daq.DAQmx_Val_GroupByChannel, self.pulse, None, None) self.StopTask()

On Tue, Jul 15, 2014 at 4:56 PM, codedragon [email protected] wrote:

Can you paste some code? Hard to help if we have no idea what the problem is. You can take a look at my code that uses PyDAQmx, and see if that helps. https://github.com/codedragon/pydaq

— Reply to this email directly or view it on GitHub https://github.com/clade/PyDAQmx/issues/16#issuecomment-49091406.

xakni1 avatar Jul 16 '14 17:07 xakni1

How far did you get. I'm in a similar position. Also want to output some analogue voltages. Any suggestions?

dr-bob-price avatar Mar 02 '16 13:03 dr-bob-price