Processing Serial - FabLabSeoul/WingProject GitHub Wiki
Processing ํ๋ก๊ทธ๋จ์์ Serial ์ ๋ณด๋ฅผ ํ์ฑํ๋ ๋ถ๋ถ์ ์ ๋ฆฌํ๋ค.
์๋ฆฌ์ผ๋ก "Start,123,aaa,bbb,ccc,ddd" ํํ์ ์ ๋ณด๊ฐ ๋์ด์ฌ ๋, ํ์ฑํ๋ ๋ฒ.
int lf = 10;
String message = myPort.readStringUntil(lf);
if (message != null)
{
String [] data = message.split(","); // ์ฝค๋ง(,) ๋ฅผ ์ด์ฉํ์ฌ ๋ฐ์ ๋ฐ์ดํฐ๋ฅผ ์๋ฅธ๋ค.
if (data[0].equals("Start"))// ์๋ฅธ ๋ฐ์ดํฐ์ค ์ ์ผ ์ฒ์์ด Start์ผ ๊ฒฝ์ฐ
{
try {
int n1 = Integer.parseInt(data[1]);
String s1 = data[2];
}
catch(Throwable t) {
}
}
}
======================================================