フィルターのクリア

Arduino digitalWrite using S-Function not working

1 回表示 (過去 30 日間)
ravi kumar
ravi kumar 2017 年 3 月 13 日
回答済み: gdz 2023 年 2 月 1 日
hi it looks like there is some defect with Matlab S-Function Builder. A simple digitalWrite using S function block does not work. Can anybody point out any errors?
here is the s function settings;
libraries tab:
#ifndef MATLAB_MEX_FILE
#include <Arduino.h>
int val = 0;
#endif
discrete updates tab:
if(xD[0] != 1){
#ifndef MATLAB_MEX_FILE
pinMode(SW[0], INPUT);
#endif
xD[0] = 1;
}
outputs tab:
if(xD[0] == 1){
#ifndef MATLAB_MEX_FILE
val = digitalRead(SW[0]);
digitalWrite(out[0], val);
#endif
}
whats wrong with the code? I have doubt in global variable declaration.
any help is appreciated
thanks

回答 (1 件)

gdz
gdz 2023 年 2 月 1 日
The SW[0], out[0] are not defined.

カテゴリ

Help Center および File ExchangeInstrument Control Toolbox Supported Hardware についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by