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 › dynamically start/stop serial communication
Page Index Toggle Pages: 1
dynamically start/stop serial communication (Read 1075 times)
dynamically start/stop serial communication
Apr 2nd, 2009, 2:53pm
 
Hi all,

I'm trying to dynamically start and stop a serial communication to a specific port. i did find the serial.stop(), but isn't there kind of a serial.start()?

in the end, i'd like to interreupt the communication, to use the device for another program. if there isn't kind of a serial.start(), does anybody know another solution?

cheers
Re: dynamically start/stop serial communication
Reply #1 - Apr 6th, 2009, 9:09am
 
The only way I know to do that is to call stop() then assign your serial variable to a new instance of serial:

void switchPorts() {
 myserial.stop();

 myserial = new Serial(this, newPortName, 9600);

 //do other stuff if needed

}
Page Index Toggle Pages: 1