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 › communicating PC to PC using the Serial Port
Page Index Toggle Pages: 1
communicating PC to PC using the Serial Port (Read 2325 times)
communicating PC to PC using the Serial Port
Dec 3rd, 2009, 9:36pm
 
Is it possible to communicate using the serial port between two computers?

I've written a simple read and write program and had one computer write to the port of the other computer and the second computer read the data. But after working at it, I haven't gotten the two PC's to talk to each other. I just get the -1 value that means there is nothing to read from the port. (I'm using a USB to Serial cable and hooking up to the Serial (D9) of another computer)

Today, I found out about the SerialEvent() function. But I dont think its getting called. Any help on this would be great!
Re: communicating PC to PC using the Serial Port
Reply #1 - Dec 3rd, 2009, 10:10pm
 
heres my code:
//testing reading from a serial port

import processing.serial.*;
int val = 0;
Serial myPort;

void setup(){
 size(200,200);
 
 println(Serial.list());
 myPort = new Serial(this,"COM7",9600);
 
}

void draw(){
 background(val);
 
 
}

void SerialEvent(Serial myPort){
  val = myPort.read();
 println("Raw Input: "+val);
}
Re: communicating PC to PC using the Serial Port
Reply #2 - Dec 3rd, 2009, 10:13pm
 
//testing writing to the serial port

import processing.serial.*;
int val = 0;
Serial myPort;

void setup(){
 size(200,200);
 
 println(Serial.list());
 myPort = new Serial(this, "COM7", 9600);
 myPort.write(65);
}

void draw(){
 
 background(val);
 //val = myPort.read();
 println(val);
}

void SerialEvent(Serial myPort){
 val = myPort.read();
 println("Raw Input: " + val);
 println(val);
 
}
Re: communicating PC to PC using the Serial Port
Reply #3 - Dec 3rd, 2009, 10:14pm
 
Do you want to connect two computers? or is it about the serial connection that is important ?

cause if not. There is a a nice processing example in your sketch folder.
its called sharedCanvasServer / client
Re: communicating PC to PC using the Serial Port
Reply #4 - Jan 14th, 2010, 10:34pm
 
The Serial connection is important. I'm trying to get the two to talk so I can demonstrate to my professor that it can communicate to something other than the microcontroller. Basically that my programs run independent with any RS-232 data.
Page Index Toggle Pages: 1