Hallo.
Im trying to write a Programm, which will allow me to Analyse with a myDAQ a joistick with an hallsensor. I have found some function to realise that but it doesent works, how I wants it. Here is the Code: clear all close all clc
s = daq.createSession('ni'); addAnalogInputChannel(s,'myDAQ1', 0, 'Voltage'); %%OUT2, X-Achse addAnalogInputChannel(s,'myDAQ1', 1, 'Voltage'); %%OUT1, Y-Achse s.Rate = 200000; s.DurationInSeconds = 1; s lh = addlistener(s,'DataAvailable', @(src,event) plot(event.TimeStamps, event.Data));
s.NotifyWhenDataAvailableExceeds = 20000;
s.IsContinuous = true; s.startBackground()
s.wait()
delete(lh)
The Problem ist, I wants the Y-Achs have a stable value for valtage between -12 an 12 Volts and X-Achs from 0 to 1 sec. In the Code above the values of the achses are changing. Ihave tryed the other plot Option, but then I get error messeges.
Could somebody help me please. My goul is to create a Simulation of an oscilloscope for analysing the hallsensors.
Thanks

댓글 수: 2

Jan
Jan 2017년 5월 25일
Please post the code in a readable format: use the "{} Code" button. Then post a complete copy of teh error message.
Vitali Walter
Vitali Walter 2017년 5월 25일
clear all close all clc
s = daq.createSession('ni');
s.IsContinuous = true;
addAnalogInputChannel(s,'myDAQ1', 0, 'Voltage'); %%OUT2, X-Achse
addAnalogInputChannel(s,'myDAQ1', 1, 'Voltage'); %%OUT1, Y-Achse
s.Rate = 200000;
lh = addlistener(s,'DataAvailable', @(src,event) plot(event.TimeStamps, event.Data));
%s.NotifyWhenDataAvailableExceeds = 20000;
s.startBackground();
s.wait()
delete(lh)

댓글을 달려면 로그인하십시오.

답변 (1개)

Vitali Walter
Vitali Walter 2017년 5월 25일

0 개 추천

clear all close all clc
s = daq.createSession('ni'); s.IsContinuous = true;
addAnalogInputChannel(s,'myDAQ1', 0, 'Voltage'); %%OUT2, X-Achse addAnalogInputChannel(s,'myDAQ1', 1, 'Voltage'); %%OUT1, Y-Achse
s.Rate = 200000;
lh = addlistener(s,'DataAvailable', @(src,event) plot(event.TimeStamps, event.Data));
%s.NotifyWhenDataAvailableExceeds = 20000;
s.startBackground();
s.wait()
delete(lh)

카테고리

도움말 센터File Exchange에서 Hardware Discovery and Setup에 대해 자세히 알아보기

태그

질문:

2017년 5월 25일

댓글:

2017년 5월 25일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by