i want to receive 16 bytes data through rs485 port with kc868-a16s.
but the received value is strange.
please le me know what should i check.
#define A16S_RS485_RX 32
#define A16S_RS485_TX 33
void setup() {
Serial.begin(115200);
Serial2.begin(19200,SERIAL_8N1,A16S_RS485_RX,A16S_RS485_TX); //A16S
Serial.println("A16S RS485 OK");
}
void loop() {
if (Serial2.available() > 0) {
Serial.print("rs485 received value : ");
Serial.println(Serial2.read());
}
delay(1000);
}
18:57:15.956 -> rs485 received value : 1
18:57:16.936 -> rs485 received value : 134
18:57:17.966 -> rs485 received value : 160
18:57:19.011 -> rs485 received value : 255
18:57:19.932 -> rs485 received value : 255
18:57:20.964 -> rs485 received value : 255
18:57:21.944 -> rs485 received value : 240
18:57:22.973 -> rs485 received value : 0
18:57:23.950 -> rs485 received value : 0
18:57:24.938 -> rs485 received value : 0
18:57:25.967 -> rs485 received value : 30
18:57:26.948 -> rs485 received value : 165
sending data attached.
but the received value is strange.
please le me know what should i check.
#define A16S_RS485_RX 32
#define A16S_RS485_TX 33
void setup() {
Serial.begin(115200);
Serial2.begin(19200,SERIAL_8N1,A16S_RS485_RX,A16S_RS485_TX); //A16S
Serial.println("A16S RS485 OK");
}
void loop() {
if (Serial2.available() > 0) {
Serial.print("rs485 received value : ");
Serial.println(Serial2.read());
}
delay(1000);
}
18:57:15.956 -> rs485 received value : 1
18:57:16.936 -> rs485 received value : 134
18:57:17.966 -> rs485 received value : 160
18:57:19.011 -> rs485 received value : 255
18:57:19.932 -> rs485 received value : 255
18:57:20.964 -> rs485 received value : 255
18:57:21.944 -> rs485 received value : 240
18:57:22.973 -> rs485 received value : 0
18:57:23.950 -> rs485 received value : 0
18:57:24.938 -> rs485 received value : 0
18:57:25.967 -> rs485 received value : 30
18:57:26.948 -> rs485 received value : 165
sending data attached.