Pages: [1]   Go Down
Author Topic: Processing Controlling Multiple Serials  (Read 459 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 547
Posts: 45973
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
  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.
Logged

Pages: [1]   Go Up
Jump to: