Go Down

Topic: method to read two separate serial ports (Read 226 times) previous topic - next topic

Loren

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


main sketch:
Code: [Select]

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

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




comms:

Code: [Select]


void Comms::method(int port){

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


can someone point me in the right direction?

AWOL

Switch/case or an array.

Make sure you get the correct spelling of "method"
"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.

Go Up