Hello guys,
I would like to print list of COM ports list in a window, so user could pick one from the list.
I used an example I found on the forum, and tried to upgrade it with my request.
I have tryed this:
int state = 0;
String result="";
import processing.serial.*;
Serial port;
StringList list = ArrayList(Serial.list);
void setup() {
size(500, 500);
}
void draw() {
background(255);
switch (state)
{
case 0:
fill(0);
text (list,10,100);
text ("Please enter the number corresponding to the COM port you are sing for the device. \n And press ENTER."+result, 10, 50);
break;
case 1:
fill(255, 2, 2);
text ("You have etered: "+result, 100, 200);
break;
}
}
void keyPressed() {
if (key==ENTER||key==RETURN) {
state++;
} else
result = result + key;
*/
}
It keeps showing me an error: “list cannot be resolved or is not a field”.
It seems I can not define the ArrayList.
When I tried printArray() it worked just fine, but it only shows the array elements inside the programming console.