Skip to content

12. Networking and communications

In our Group Work, we tried communication with each made Development Board by using TX and RX signal transformation.

Following boards were used for our Group Work communication.
Communication Board

Connect One Board’s “TX” to the other board’s “RX” each other.

Code from one project (Katoh);

void setup() {
  // initialize both serial ports:
  Serial.begin(115200);
  //Serial0.begin(115200);
  Serial1.begin(115200, SERIAL_8N1, D7, D6); 
}

void loop() {
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    // int inByte = Serial0.read();
    String s =Serial1.readString();
    delay(50); 
    // Serial.write(inByte);
    Serial.println(s);
  //}

  // read from port 0, send to port 1:
  // if (Serial.available()) {
    // int inByte = Serial.read();
    // Serial0.write(inByte);
    String t =Serial.readString();
    delay(50); 
  Serial1.println("katoh");
  }
}

Code from the other Project (Hanamido);

void setup() {
  // initialize both serial ports:
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {

  Serial1.available();
  int x = Serial.read();
  Serial1.println(x);
  delay(2000); 
  String s =Serial1.readString();
  Serial.println(s);
}

Message received in one Board;
received message in One Board

In the seril monitor The number is ASCII code ex. 49=1,65=A,97=a… -1 = ASCII code not found error. This is because other boards are not sending ASCII codes and are continuously sending information that there is nothing.

Message received in the other Board;
received message in the other Board

In the seril monitor received “katoh” ASCII code

Exchanging messages each other

Signal condition was also measured by Logic Analyzer
signal measured by logic analyzer Logic Analyzer

Signal measured by Logic Analyzer;
total

Signal measured in RX
katoh

Signal measured in TX
alt text