Java 接收从处理到arduino的字符串
我想从processing接收到arduino的字符串。我正在写一个字符串(基本上是一个字符串形式的单位数数组,例如:是一个数组:0 2 1 3)。我可以将其写入端口,但如何在arduino上接收?以下代码将发送给arduinoJava 接收从处理到arduino的字符串,java,arduino,processing,Java,Arduino,Processing,我想从processing接收到arduino的字符串。我正在写一个字符串(基本上是一个字符串形式的单位数数组,例如:是一个数组:0 2 1 3)。我可以将其写入端口,但如何在arduino上接收?以下代码将发送给arduino int[] send={0,2,3,1}; myPort =new Serial(this,"/dev/ttyACM0", 9600); String theStg = "<" + nf(send[0], 3) + " " +
int[] send={0,2,3,1};
myPort =new Serial(this,"/dev/ttyACM0", 9600);
String theStg = "<" + nf(send[0], 3) +
" " + nf(send[1], 3) +
" " + nf(send[2], 3) +
" " + nf(send[3], 3) +
">";
myPort.write(theStg);
int[]send={0,2,3,1};
myPort=new Serial(这是“/dev/ttyACM0”,9600);
字符串theStg=“”;
myPort.write(theStg);
如果您使用的是char*字符串,而不是string类,那么您可以使用command
这一问题已经得到解决
您只需在代码中添加与strtok()等效的内容,但只需在字符串对象上添加即可。,