Go Down

Topic: Processing Controlling Multiple Serials (Read 540 times) previous topic - next topic

Skorb

Hi,

I have a processing sketch that sends data out a single serial to an Ardunio board, and from there drives two 4-pin steppers.

I would like to double the number of steppers, due to the amount of pins this requires a second Arduino board to take input from the processing sketch.

Is there a way to tell processing to write outputs to 2 different serials?

Cheers, SKORB

b0bbykey

I own arduino nano, which has only one serial port so I use NewSoftSerial library to create additional port, you can get the library here http://arduiniana.org/libraries/newsoftserial/
you could create additional port with newsoftserial and then send data to it right after you've send data to "primary" port

PaulS

Yes, you can have Processing communicate with two different serial ports at the same time.

You create an instance of the Serial class, in Processing using something like this:
Code: [Select]
  myPort = new Serial(this, Serial.list()[2], 2400);
The port to bind to is defined by the second argument.

Just create two instances, one for each Arduino, with different names, of course, and use the appropriate instance to talk to each Arduino.

Go Up