We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › PROCESSING NOT RECOGNIZE SERIAL PORT
Page Index Toggle Pages: 1
PROCESSING NOT RECOGNIZE SERIAL PORT (Read 1015 times)
PROCESSING NOT RECOGNIZE SERIAL PORT
Aug 5th, 2008, 6:08pm
 
Hello Im using a Mac Intel OSX 10.5.4 and trying connect Arduino with processing

I had these code in Arduino API

/////

int resetButton = 3;
int serveButton = 2;

int reset = 0;
int serve = 0; //

void setup(){

Serial.begin(9600);

pinMode(resetButton, INPUT);
pinMode(serveButton, INPUT);

}

void loop () {
 
reset = digitalRead(resetButton);
serve = digitalRead(serveButton);
 
Serial.print(reset, DEC);
Serial.print(".");
Serial.println(serve, DEC);
}

I try it on the protoard and work fine.
Then I try in procesing these code


import processing.serial.*;

int linefeed = 10;
Serial myPort;

void setup() {
 println(Serial.list());  
 myPort = new Serial(this, Serial.list()[0], 9600);
 myPort.bufferUntil(linefeed);
}
 
 void draw(){
 }
 
 void serialEvent(Serial myPort) {
  String myString = myPort.readStringUntil(linefeed);
  if (myString != null) {
   myString =trim(myString);
     int sensors[] = int (split(myString, ','));
   for (int sensorNum = 0; sensorNum < sensors.length; sensorNum++) {
    print("Sensor " + sensorNum + ": " + sensors[sensorNum] + "\t");
   }

   println();
 }
 }

And these happen list the ports:

Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
[0] "/dev/tty.usbserial-A4000PEj"
[1] "/dev/cu.usbserial-A4000PEj"
[2] "/dev/tty.Bluetooth-PDA-Sync"
[3] "/dev/cu.Bluetooth-PDA-Sync"
[4] "/dev/tty.Bluetooth-Modem"
[5] "/dev/cu.Bluetooth-Modem"
[6] "/dev/tty.Carlina-COM1-1"
[7] "/dev/cu.Carlina-COM1-1"
[8] "/dev/tty.Tufather-Dial-UpNetwork-1"
[9] "/dev/cu.Tufather-Dial-UpNetwork-1"

BUT THE TWO SENSORS WERE NOT READ

Sensor 0: 0
Sensor 0: 0
Sensor 0: 0
Sensor 0: 0
over and over...

I try other codes with example  push button, but the same thing happen.


The serial port is not being recongnized. Im using Processing 135 because, I got several problems running version 142 and 143. Could some one could help me it.

thanks
IN

   
 


Re: PROCESSING NOT RECOGNIZE SERIAL PORT
Reply #1 - Aug 13th, 2008, 11:20pm
 
Could it be that you're splitting the string with a comma "," but your arduino is sending a period "." ?

This would also explain why you processing code is only printing sensor 0 and not both sensor 0 and sensor 1.

Sparky
Page Index Toggle Pages: 1