Digital I/O
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.
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
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.
How far did you get. I'm in a similar position. Also want to output some analogue voltages. Any suggestions?