请您提供一些在Linux中与scilab进行串行通信的示例。当我发出命令时:
h=openserial(1,"9600,n,8,1");
我收到以下错误:
-->h=openserial(1,"9600,n,8,1");
!--error 999
TCL_EvalStr, at line 1
bad option "-mode": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, or -translation
while executing
"fconfigure file114 -mode 9600,n,8,1"
at line 27 of function openserial called by :
h=openserial(1,"9600,n,8,1");
答案 0 :(得分:0)
与Arduino设备进行简单的串行通信只需要指定为openserial中第二个参数的波特率。看起来像字符串参数(n?)中的其他变量正在弄乱。
Scilab 5.4示例,带有串行工具箱,用于com端口3和波特率9600.在尝试读取串口之前延迟5秒。
h = openserial(3,"9600");
xpause(5000000);
data = readserial(h);
closeserial(h);
与您的arduino设备上的一些串行垃圾邮件代码一起,您应该在Scilab的每次运行中收到一串数据。
Arduino设备上串行的示例代码:
int cc=0;
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.println(cc);
if (cc<10){
cc++;
}
else{
cc=0;
}
delay(100);
}