From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI Daqmx with Python

 

Hi,

Newbie to Python for NI.

I want to generate a continuous sine wave with frequency=60 Hz and amplitude = 4V .

I want to use Python NIDAQMX for this(have NI 9269 module ,if that matters)

What is the best way to do this?

Here is the basic code  I used, and works, for DC output. But not sure if there is any function generator for sine wave? or I have to make an array of points first and then send them to output channel? Is there any document available for beginners or examples showing how to do the basic tasks like this one? If I can get some basic code to do this that will be appreciated. but for me ,learning this stuff is important as well. Thanks.

 

code which works for DC output

 

import nidaqmx
import numpy as np
for x in range(100):
with nidaqmx.Task() as task:
task.ao_channels.add_ao_voltage_chan("cdaq2Mod2/ao2")
task.write([1.0], auto_start=True)

 

0 Kudos
Message 1 of 1
(1,115 Views)