نقل قول نوشته اصلی توسط feredy2011 نمایش پست ها
دقیقا مهندس از همین کتابخونه استفاده کردم. ولی خب پرسیدم ببینم میشه یا نه ! مرسی

سلام
میتونی دو تا softwareserial تعریف کنی
فقط یه نکته داره اونم اوینه که دقیقا و همزمان نمیتونن ارسال کنن
یه delay حدود 10 میلی بزاری احت جواب میگیری
برای کدش هم از نمونه دوم مثال کتابخونه softwareserial استفاده کن .
نمونه کدش اینه :
کد:
#include <SoftwareSerial.h>
// software serial #1: RX = digital pin 10, TX = digital pin 11
SoftwareSerial portOne(10, 11);


// software serial #2: RX = digital pin 8, TX = digital pin 9
// on the Mega, use other pins instead, since 8 and 9 don't work on the Mega
SoftwareSerial portTwo(8, 9);


void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }




  // Start each software serial port
  portOne.begin(9600);
  portTwo.begin(9600);
}


void loop() {
  // By default, the last intialized port is listening.
  // when you want to listen on a port, explicitly select it:
  portOne.listen();
  Serial.println("Data from port one:");
  // while there is data coming in, read it
  // and send to the hardware serial port:
  while (portOne.available() > 0) {
    char inByte = portOne.read();
    Serial.write(inByte);
  }


  // blank line to separate data from the two ports:
  Serial.println();


  // Now listen on the second port
  portTwo.listen();
  // while there is data coming in, read it
  // and send to the hardware serial port:
  Serial.println("Data from port two:");
  while (portTwo.available() > 0) {
    char inByte = portTwo.read();
    Serial.write(inByte);
  }


  // blank line to separate data from the two ports:
  Serial.println();
}
اینم جایی که میتونی بیاریش:
برای دیدن سایز بزرگ روی عکس کلیک کنید

نام: 2016-09-03_8-50-59.jpg
مشاهده: 176
حجم: 19.3 کیلو بایت