We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello and good day, im trying to run sketch for a 3d cube but when i try to run the sketch i get the error " Could not run the sketch (Target VM failed to initialize) " here is the code and the port = new Serial(this,Serial.list()[1], 115200);
code is highlighted, im not sure what went wrong.
import processing.serial.*;
Serial port;
int X;
int Y;
int Z;
float a;
float offset = PI/24.0;
int num = 1;
boolean pink = true;
void setup()
{
size(800, 600, P3D);
noStroke();
lights();
println((Object[])Serial.list());
port = new Serial(this,Serial.list()[1], 115200);
port.clear();
}
void draw()
{
background(0, 0, 26);
translate(width/2, height/2);
while(port.available() == 0){
}
char reading = 0;
while (reading != 'x') {
while(port.available() == 0){
}
reading = (char)port.read();
}
X = port.read();
while (reading != 'y') {
while(port.available() == 0){
}
reading = (char)port.read();
}
Y = port.read();
while (reading != 'z') {
while(port.available() == 0){
}
reading = (char)port.read();
}
Z = port.read();
{
pushMatrix();
stroke(0);
rotateY((float)X/50.0);
rotateX((float)Z/50.0);
rotateZ((float)Y/50.0);
scale(90);
beginShape(QUADS);
fill(0, 1, 1);
vertex(-1, 1, 1);
fill(1, 1, 1);
vertex( 1, 1, 1);
fill(1, 0, 1);
vertex( 1, -1, 1);
fill(0, 0, 1);
vertex(-1, -1, 1);
fill(1, 1, 1);
vertex( 1, 1, 1);
fill(1, 1, 0);
vertex( 1, 1, -1);
fill(1, 0, 0);
vertex( 1, -1, -1);
fill(1, 0, 1);
vertex( 1, -1, 1);
fill(1, 1, 0);
vertex( 1, 1, -1);
fill(0, 1, 0);
vertex(-1, 1, -1);
fill(0, 0, 0);
vertex(-1, -1, -1);
fill(1, 0, 0);
vertex( 1, -1, -1);
fill(0, 1, 0);
vertex(-1, 1, -1);
fill(0, 1, 1);
vertex(-1, 1, 1);
fill(0, 0, 1);
vertex(-1, -1, 1);
fill(0, 0, 0);
vertex(-1, -1, -1);
fill(0, 1, 0);
vertex(-1, 1, -1);
fill(1, 1, 0);
vertex( 1, 1, -1);
fill(1, 1, 1);
vertex( 1, 1, 1);
fill(0, 1, 1);
vertex(-1, 1, 1);
fill(0, 0, 0);
vertex(-1, -1, -1);
fill(1, 0, 0);
vertex( 1, -1, -1);
fill(1, 0, 1);
vertex( 1, -1, 1);
fill(0, 0, 1);
vertex(-1, -1, 1);
endShape();
popMatrix();
}
}
Answers
windows? nvidia card?
https://forum.processing.org/two/discussion/20562/could-not-run-the-sketch-target-vm-failed-to-initialize-errors-windows-nvidia
i tried using older laptops with windows 7 and older nvidia but still the same error. Not sure what to do, im still new to processing
Can you run any example sketch that does not required serial? Do they run?
Silly question, are you sure the port you want to open is
Serial.list()[1]
? What does your println() in line 22 return?Kf