Go Down

Topic: Trouble with graphing analog input to Processing (Read 684 times) previous topic - next topic

somethingElse

Trying to use the basic Graph setup from the examples library.
I'm getting the following error in Processing:

Quote
WARNING:  RXTX Version mismatch
   Jar version = RXTX-2.2pre1
   native lib Version = RXTX-2.2pre2
  • "/dev/tty.modem"
    [1] "/dev/cu.modem"
    [2] "/dev/tty.usbserial-A700eXmJ"
    [3] "/dev/cu.usbserial-A700eXmJ"
    dyld: lazy symbol binding failed: Symbol not found: _open$UNIX2003
     Referenced from: /Applications/Processing 2.app/Contents/Resources/Java/modes/java/libraries/serial/library/macosx/librxtxSerial.jnilib
     Expected in: /usr/lib/libSystem.B.dylib

    dyld: Symbol not found: _open$UNIX2003
     Referenced from: /Applications/Processing 2.app/Contents/Resources/Java/modes/java/libraries/serial/library/macosx/librxtxSerial.jnilib
     Expected in: /usr/lib/libSystem.B.dylib
[/color]

Here's my code in Processing:

Code: [Select]
// Processing code for this example

// Graphing sketch


// This program takes ASCII-encoded strings
// from the serial port at 9600 baud and graphs them. It expects values in the
// range 0 to 1023, followed by a newline, or newline and carriage return

// Created 20 Apr 2005
// Updated 18 Jan 2008
// by Tom Igoe
// This example code is in the public domain.

import processing.serial.*;

Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph

void setup () {
// set the window size:
size(400, 300);        

// List all the available serial ports
println(Serial.list());
// I know that the first port in the serial list on my mac
// is always my  Arduino, so I open Serial.list()[0].
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[0], 9600);
// don't generate a serialEvent() unless you get a newline character:
myPort.bufferUntil('\n');
// set inital background:
background(0);
}
void draw () {
// everything happens in the serialEvent()
}

void serialEvent (Serial myPort) {
// get the ASCII string:
String inString = myPort.readStringUntil('\n');

if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// convert to an int and map to the screen height:
float inByte = float(inString);
inByte = map(inByte, 0, 1023, 0, height);

// draw the line:
stroke(127,34,255);
line(xPos, height, xPos, height - inByte);

// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(0);
}
else {
// increment the horizontal position:
xPos++;
}
}
}




Grumpy_Mike

Well I just tried that code on my Mac and I don't get any errors.
However from the list it looks like your arduino is not the first one on it.
Try changing:-
Code: [Select]
myPort = new Serial(this, Serial.list()[0], 9600);
to
Quote
myPort = new Serial(this, Serial.list()[2], 9600);

somethingElse

I fixed that, but that wasn't it. It might have something to do with installing the current version of processing, then installing an older version. I'll try reinstalling it.

somethingElse

ok, I know this is gonna sound really silly, but my computer clock was set to a date in 1969. I set it correctly and the error message stopped popping up (on one file). But the program in processing keeps crashing. So I tried the simple analog read program, the example is listed in processing, and got the rxtx mismatch error again, and then it crashed my processing sketch. I'm running the stable version of Processing 1.5.1 on Mac OS 10.4.

I'm also running into the problem where the serial monitor isn't mapping the changes in my analog sensor. Same results no matter what. The arduino board, however, does notice the changes, so I know the error isn't with my schematic. I'm just projecting that this will be the next error I have to solve getting this project up and running, but they might be connected errors.

Grumpy_Mike

Quote
I'm also running into the problem where the serial monitor isn't mapping the changes in my analog sensor. Same results no matter what. The arduino board, however, does notice the changes, so I know the error isn't with my schematic.

How do you know the arduino board notices the changes if not through the serial monitor.

Time to post your arduino code.

Go Up