Pages: [1]   Go Down
Author Topic: method to read two separate serial ports  (Read 212 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 155
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not sure how to accomplish what I'd like.  The code below obviously doesn't work:


main sketch:
Code:
  if (Serial1.available () > 0) {
    comms.mehtod(1);
  }  // end of incoming data

  if (Serial3.available () > 0) {
    comms.method(3);
  }  // end of incoming data



comms:

Code:

void Comms::method(int port){

int inByteT = Serial(port).read();
}

can someone point me in the right direction?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26632
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Switch/case or an array.

Make sure you get the correct spelling of "method"
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: