2
votes

I hope this exact issue was not addressed already. I did search for a while.

So I'm using the Arduino library for Processing, testing it by simply having it blink an LED that I have connected to my Arduino UNO. I'm following this tutorial, but am having a problem a little different than the ones covered on that tutorial page. Here's my Processing code:

import processing.serial.*;

import cc.arduino.*;


Arduino arduino;

int ledPin = 13;

void setup()
{

  //println(Arduino.list());

  arduino = new Arduino(this, Arduino.list()[0], 57600); //error here

  arduino.pinMode(ledPin, Arduino.OUTPUT);

}

void draw()

{

  arduino.digitalWrite(ledPin, Arduino.HIGH);

  delay(1000);

  arduino.digitalWrite(ledPin, Arduino.LOW);

  delay(1000);

}

Here's my 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 sketch_130206a.setup(sketch_130206a.java:29)

at processing.core.PApplet.handleDraw(PApplet.java:2117)

at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)

at processing.core.PApplet.run(PApplet.java:2020)

at java.lang.Thread.run(Thread.java:680)

Since my error apparently has to do with access permissions, I tried doing what it says at the tutorial page I was following by going to /var/lock folder, but the /lock folder doesn't exist! I'm using a Mac 10.8.2. I searched around and found this thread (arduino dot cc/forum/index.php?topic=135164.0) and decided to try "sudo mkdir -p /var/lock" and "sudo chmod 777 /var/lock" in terminal, but it didn't change the error I have in Processing, even after restarting it. I also tried opening the Arduino app and uploading the StandardFirmata sketch as mentioned at the ProcessngxArduino library download page (playground.arduino dot cc/interfacing/processing) while trying to run the processing sketch, but same error. The fact that I'm using the Arduino UNO instead of the Duemilanove shouldn't be the issue as the UNO is apparently just an updated version of it. Any ideas what I could try to do next?

UPDATE: Okay so the highlighted error in my code is what opens the serial port I'm using at whatever rate (57600 bits/sec in this case I think). So I think the problem lies in this particular step in the instructions at the adrunio x processing info page mentioned earlier(playground dot arduino dot cc/interfacing/processing), step 3: "Configure Processing for serial: processing dot org/reference/libraries/serial/"... the link goes to processing's 'serial' reference page. I'm confused about what is meant by "configure"? How exactly do I figure out my "correct serial port"? I went through the rest of the instructions and the examples on the serial reference page, and still have no idea what I'm looking for.

UPDATE #2: My serial port for the arduino is "/dev/tty.usbmodem1411". I am still confused about how to plug this in to my code in Processing though. The things I just learned in these last 2 updates might be irrelevant to my error, I'm still unsure.

1
Do you need Processing with an arduino lib for this? Can you not achieve the tuning effect purely in the arduino-specific version of Processing that's downloadable on arduino.cc?Mike 'Pomax' Kamermans
Mike - the point of this is to connect Arduino to a game-building engine called Unity, Processing being the middleman in this process. Blinking an LED is just a simple way for me to test that the Arduino - Processing connection is working.A__
Is this on Processing beta (2.0), or on the latest stable (1.5.1)? There's some forums posts on the arduino.cc site about the same kind of error, which seem related to the version of Processing used. (if it's on 2.0, it might be worth filing a bug on at code.google.com/p/processing/issues)Mike 'Pomax' Kamermans
Okay I ran it with Processing 1.5.1, and got a different error, BUT it is the one that is covered on the tutorial page I was following initially (sundh.com/blog/2011/05/get-processing-and-arduino-to-talk)!! Going to attempt to get through it and update in a bit.A__
Yup, it works now. So much time and energy for something so simple. I don't have enough reputation to answer my own question yet, so feel free to answer, otherwise I'll do so in a couple hours. Thanks Mike!A__

1 Answers

1
votes

The problem was that I was using the beta version of Processing (2.0). Use the latest stable version (1.5.1) and it should work.