Go Down

Topic: Arduino + processing on Ubuntu - no serial list (Read 1 time) previous topic - next topic

TideMan

I have a simple switch circuit on the Arduino and the following code:
Code: [Select]
int switchPin = 4;                       // Switch connected to pin 4

void setup() {
  pinMode(switchPin, INPUT);             // Set pin 4 as an input
  Serial.begin(9600);                    // Start serial communication at 9600 bps
}

void loop() {
  if (digitalRead(switchPin) == HIGH) {  // If switch is ON,
    Serial.println(1);               // send 1 to Processing
  } else {                               // If the switch is not ON,
    Serial.println(0);               // send 0 to Processing
  }
  delay(100);                            // Wait 100 milliseconds
}


On the serial monitor I see rows of 1 until I hit the switch when I get 0's.

In processing my code is:
Code: [Select]
import processing.serial.*;

import processing.serial.*;
Serial myport; // Create object from Serial class

void setup() {
println("Here is a list of serial ports:");
println(Serial.list());
println("List finished, opening port");
myport = new Serial(this, "ttyACM0", 9600);
myport.bufferUntil('\n');
}
void draw()
{
}

void serialEvent(Serial myport)
{
String inString = myport.readStringUntil( '\n' );

println(inString);
}


and what I see is:
Quote
Here is a list of serial ports:
WARNING:  RXTX Version mismatch
   Jar version = RXTX-2.2pre1
   native lib Version = RXTX-2.2pre2
List finished, opening port


Evidently, when I invoke Serial.list() the warning is printed and it returns nothing.
Then, when I hardwire in the port as ttyACM0, I still get nothing.

What is wrong?

PaulS

Which Arduino do you have? What version of Processing?

TideMan



PaulS

You have an Arduino 1.0.1? Is that like a UNO+ or something?

TideMan

#5
May 31, 2012, 04:46 am Last Edit: May 31, 2012, 04:47 am by TideMan Reason: 1

You have an Arduino 1.0.1? Is that like a UNO+ or something?


No, that's the software version.


ram_tenet

I had ran into the same issue a while back and i upgraded the RXTX library and the JDK on the machine which fixed things for me.

My initial indicators came from processing forum at
http://forum.processing.org/topic/rxtx-version-mismatch

Thanks,
Ram
Technical Evangelist/Writer,
Tenet Technetronics,
Bangalore, India

TideMan

I finally solved this problem by taking some ideas from this thread at processing:
http://forum.processing.org/topic/rxtx-version-mismatch-12-2-2012

The main point is to replace some of the files shipped with processing with the files that are shipped with Arduino.

Step 1.  In Places on Ubuntu, navigate to:
                 processing-1.5.1/modes/java/libraries/serial/library
            and rename RXTXcomm.jar to RXTXcomm.jar.old or similar
Step 1a.  Go to /linux32 and rename librxtxSerial.so to librxtxSerial.so.old
Step 1b.  Go to /linux64 and rename librxtxSerial64.so to librxtxSerial64.so.old

Step 2.  Open another Places and navigate to:
             arduino-1.0.1/lib

Step 3.   Copy Arduino's
                     RXTXcomm.jar to processing-1.5.1/modes/java/libraries/serial/library/
                     librxtxSerial.so to processing-1.5.1/modes/java/libraries/serial/library/linux32/
                     librxtxSerial64.so to processing-1.5.1/modes/java/libraries/serial/library/linux64/

This fixed it for me using:
Ubuntu 10.04
arduino-1.0.1
processing-1.5.1

Go Up