Error to connect Arduino and Processing
in
Integration and Hardware
•
11 months ago
Hello!
I am relatively new to Processing, and I am trying to connect Processing and Arduino with Firmata.
I am using the 32 bit version of Processing and Java (a previous problem with Firmata forced me to).
Now, when I try to run one of the 3 examples given with the library, such as the arduino_pwm example, I get this error:
illegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
Exception in thread "Animation Thread" java.lang.IllegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
at cc.arduino.Arduino$SerialProxy.<init>(Arduino.java:119)
at cc.arduino.Arduino.<init>(Arduino.java:168)
at arduino_pwm.setup(arduino_pwm.java:32)
at processing.core.PApplet.handleDraw(PApplet.java:2103)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:190)
at processing.core.PApplet.run(PApplet.java:2006)
at java.lang.Thread.run(Thread.java:662)
Here is the code:
Apparently the error is situated on this line: arduino = new Arduino(this, Arduino.list()[0], 57600);
Any idea?
Thanks!
I am relatively new to Processing, and I am trying to connect Processing and Arduino with Firmata.
I am using the 32 bit version of Processing and Java (a previous problem with Firmata forced me to).
Now, when I try to run one of the 3 examples given with the library, such as the arduino_pwm example, I get this error:
illegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
Exception in thread "Animation Thread" java.lang.IllegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
at cc.arduino.Arduino$SerialProxy.<init>(Arduino.java:119)
at cc.arduino.Arduino.<init>(Arduino.java:168)
at arduino_pwm.setup(arduino_pwm.java:32)
at processing.core.PApplet.handleDraw(PApplet.java:2103)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:190)
at processing.core.PApplet.run(PApplet.java:2006)
at java.lang.Thread.run(Thread.java:662)
Here is the code:
- import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
void setup() {
size(512, 200);
arduino = new Arduino(this, Arduino.list()[0], 57600);
}
void draw() {
background(constrain(mouseX / 2, 0, 255));
arduino.analogWrite(9, constrain(mouseX / 2, 0, 255));
arduino.analogWrite(11, constrain(255 - mouseX / 2, 0, 255));
}
Apparently the error is situated on this line: arduino = new Arduino(this, Arduino.list()[0], 57600);
Any idea?
Thanks!
1