I'm not sure why "Circle" isn't being recognized in my code. The error that shows up in Processing says "Cannot find a class or type named “Circle”" I am trying to take values that are taken from a sensor (through Arduino) & visualize them in Processing. From what I saw, I thought adding "import java.util.*" would fix the problem, but it didn't. I'm not sure if the term "Circle" is just too broad, & if I have to make it "MCircle" or "PCircle" or something like that.
Here is the Processing code:
import processing.serial.*;
import java.util.*;
Serial myPort;
int val;
int amt = 10;
Circle [] circles;
void setup() {
size(500, 500);
rectMode(CENTER);
circles = new Circle[amt];
for (int i=0; i<10; i++) {
circles[i] = new Circle();
}
String portName = Serial.list()[2];
myPort = new Serial(this, portName, 9600);
// println(Serial.list());
//println(val);
}
void draw() {
//if your port is available, get the val
if ( myPort.available() > 2) {
val = myPort.read();
}
background(0);
for (int i = 0; i<10; i++) {
circles[i].display();
}
class Circle
{
float xPos;
float yPos;
Circle() {
xPos = random(width);
yPos = random(height);
}
}
}
void display() {
// ellipse(random(width), random(height), val, val);
ellipse(xPos, yPos, val, val);
}