Look for in our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

RS-232 test on M-Duino PLUS version

Introduction


In this post it is showed how to test the RS-232 M-Duino PLUS version.

Requirements

Ethernet PLC:              Ethernet PLC         

RS-232 Library :           Industrial Shields RS-232 Library (Github)


Software


Connecting an M-Duino with other equipment through RS-232.

On the Sketch is showed that you must send a 0xA5 thought RS-232 to complete this test.

RS-232 Test sketch:

/////////////////////////////////////////////////////////////////////////////
void setup() {
  Serial.begin(9600L);
  Serial.println("mduino-plus test RS-232 started");
  Serial2.begin(9600L);
}
/////////////////////////////////////////////////////////////////////////////
void loop() {
  while (Serial2.available()) {
    Serial2.read();
  }
  Serial2.write(0xa5);
  
  delay(50);
  
  if (Serial2.read() == 0xa5) {
    Serial.println("RS232 (Serial2) OK");
  } else {
    Serial.println("RS232 (Serial2) FAIL");
  }
  
  delay(1000);
}

Do you want more information?

Open Source technology allows you to develop your installations.

Just fill the form and we will contact you as soon as we can.

Send