건국대학교 혼합매체 수업 홈페이지입니다.
0_0!!!:)! 0-0! 0+0!?
import processing.serial.*;
Serial s;
boolean coin;
boolean coin2;
void setup() {
size(200,200);
s = new Serial(this,"COM3",9600);
frameRate(30);
}
void draw() {
if( s.available() > 0 ) {
int c = s.readChar();
if( c == '1' ) {
coin = !coin;
} else if( c == '0' ) {
coin2 = !coin2;
}
}
if( coin ) {
fill(0);
} else {
fill(color(random(255),random(255),random(255)));
}
ellipse(50,50,50,50);
/*
if( coin2 ) {
fill(0);
} else {
fill(color(random(255),random(255),random(255)));
}
ellipse(150,50,50,50);
line(100,80,100,130);
line(50,150,150,150);
*/
}