I am attempting to transfer code written from one Mac to another Mac. This code works on one Mac, but not on the other. I was not the original author of the code, and I have no idea where the error is.
This is the error: java.lang.NullPointerException
at processing.app.Library.getClassPath(Library.java:298)
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:390)
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:197)
at processing.mode.java.JavaBuild.build(JavaBuild.java:156)
at processing.mode.java.JavaBuild.build(JavaBuild.java:135)
at processing.mode.java.JavaMode.handleRun(JavaMode.java:176)
at processing.mode.java.JavaEditor$20.run(JavaEditor.java:481)
at java.lang.Thread.run(Thread.java:655)
This is my code: import processing.serial.*;
import controlP5.*;
Serial myPort; // The serial port:
PFont myFont; // The display font:
String inString; // Input string from serial port:
int lf = 10; // ASCII linefeed
int chartHeight = 180;
int chartWidth = 500;
// reset threshold to next value
// THRESHOLD = MAX_REACHED;
// reset values for this breach
// MAX_REACHED = 0;
beginning_of_activate = 0;
end_of_activate = 0;
}
}
// if the toy is on, but it's dropped below threshold, and it's been more than TOY_ACTIVATION_DURATION, then disable toy
if (active.getState() == true &&
ACTIVATION_STATE == ACTIVATION_STATE_INACTIVE &&
millis() - temp_beginning_of_activate > TOY_ACTIVATION_DURATION) {
active.toggle();
if (MODE == TESTING_MODE) {
THRESHOLD = MAX_REACHED;
}
return;
}
}
}
myPort.write("2");
}
}
void keyPressed() {
if (key == CODED) {
if (keyCode == UP) {
toggle_on_off();
}
}
}
void toggle_on_off() {
if (on == true) {
on = false;
} else {
on = true;
myPort.write("2");
}
println("toggling " + on);
}