프로세싱 오픈소스를 찾아서 사용하려는데
import processing.serial.*;
Serial myPort;
int rad = 0;
float cx, cy;
ArrayList<Ball> balls = new ArrayList<Ball>();
void setup()
{
size(400, 400);
cx = width/2;
cy = height*2/3;
noFill();
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
}
void draw(){
background(0);
stroke(0, 255, 36);
arc(cx, cy, width, height, PI, TWO_PI, CHORD);
float r = TWO_PI-map(rad, 0, 360, 0, TWO_PI);
line(cx, cy, cx + cos(r)* width/2, cy + sin(r)* height/2);
updateBalls();
displayBalls();
}
void updateBalls(){
for(int i = balls.size()-1 ; i > -1 ; i--){
balls.get(i).update();
if(balls.get(i).isDead())
balls.remove(i);
}
}
void displayBalls(){
for(int i = 0 ; i < balls.size() - 1 ; i++){
balls.get(i).display();
}
}
void serialEvent(Serial p){
String inString = p.readStringUntil('\n');
if(inString != null){
if(inString.startsWith("r")){
String[] strings = inString.trim().replace("r","").split("d");
if(strings.length > 1){
rad = Integer.parseInt(strings[0]);
int distance = Integer.parseInt(strings[1]);
if(distance != 0){
balls.add(new Ball(cx, cy, rad, distance));
}
}
}
}
}
이렇게 입력하면
exit status 1
'import' does not name a type
이런식으로 오류가 납니다 무엇이 문제인지 알수있을까요?
|