Go Down

Topic: Help with Arduino/Processing (Read 4023 times) previous topic - next topic

Euromas

Hello, I'm trying to use Processing with Arduino. The code in Arduino is "StandarFirmdata". And this is the code in processing (is one of the examples):

Quote
import processing.serial.*;

import cc.arduino.*;

Arduino arduino;

color off = color(4, 79, 111);
color on = color(84, 145, 158);

int[] values = { Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW };

void setup() {
  size(470, 200);
 
  println(Arduino.list());
  arduino = new Arduino(this, Arduino.list()[0], 57600);  //I have problems in this line.
 
  for (int i = 0; i <= 13; i++)
    arduino.pinMode(i, Arduino.OUTPUT);
}

void draw() {
  background(off);
  stroke(on);
 
  for (int i = 0; i <= 13; i++) {
    if (values == Arduino.HIGH)
      fill(on);
    else
      fill(off);
     
    rect(420 - i * 30, 30, 20, 20);
  }
}

void mousePressed()
{
  int pin = (450 - mouseX) / 30;
 
  if (values[pin] == Arduino.LOW) {
    arduino.digitalWrite(pin, Arduino.HIGH);
    values[pin] = Arduino.HIGH;
  } else {
    arduino.digitalWrite(pin, Arduino.LOW);
    values[pin] = Arduino.LOW;
  }
}


When I click run in Processing I get this:

Quote
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
  • "/dev/ttyACM0"
    [1] "/dev/ttyS0"
    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_output.setup(arduino_output.java:41)
       at processing.core.PApplet.handleDraw(PApplet.java:2095)
       at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:197)
       at processing.core.PApplet.run(PApplet.java:1998)
       at java.lang.Thread.run(Thread.java:662)


My O.S is Linux Ubuntu 12.04 but I have the same problem on Windows7, please help me!

Hi, we faced the same problem a couple of days ago. I just uploaded a fixed version of the library to https://github.com/pardo-bsso/processing-arduino . Let me know how it works for you.

danvoid

Thanks pardo_bsso - I had that problem and you had the solution.  :)

guillermo33

Hello

I have follow the intructions from        http://playground.arduino.cc/interfacing/processing         to install "Processing" and now I have exactly the same problem as Euromas tells trying to communicate with Arduino

I have tried the Pardo,s solution , but it does not work for me , the message of error is practically the same as Euromas

Any advice?

mreive

Thanks pardo_bsso,
I had the same problem with Processing 2 on Win XP and your library fixed it.
Now I can use Processing 2 with the Arduino.

Thanks.


Go Up