Serial communication problem with RS2428 relay module

Hello,

I am trying to communicate from Arduino to DS2824 relay via serial interface. Data from relay board to arduino is transmitted properly. But while sending data from arduino to the relay board there is a problem, if I send single digits like 1,2,3...9 or a,b...z the data received by relay board is the same. But if I send two alphanumerical like 11,43 etc or aa,vv, ds the relay board reads it differently. Also everything is getting printed in the same line.


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

void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}

// read from port 0, send to port 1:
if (Serial.available()) {
int inByte = Serial.read();
Serial1.write(inByte);
}
}

Your post was MOVED to its current location as it is more suitable.

Please follow the advice given in the link below when posting code. Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

The best way to get help is to include your complete program. Also, please make a block diagram showing how you have all this connected, including the power supply.
Paul

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.