Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Digital I/O #16

Open
xakni1 opened this issue Jul 15, 2014 · 3 comments
Open

Digital I/O #16

xakni1 opened this issue Jul 15, 2014 · 3 comments

Comments

@xakni1
Copy link

xakni1 commented Jul 15, 2014

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.

@codedragon
Copy link

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

@xakni1
Copy link
Author

xakni1 commented Jul 16, 2014

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
#16 (comment).

@dr-bob-price
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants