The transceivers are connected A-A and B-B with a jumper. I removed the termination resistors on the transceivers since with the resistors in place, I wasn't seeing anything.
I've tried switching to transmitting chars, strings, etc but same results.
Here's my sender:
Code: Select all
#include <HardwareSerial.h>
HardwareSerial Serial485Max(2);
#define S2RX 16
#define S2TX 17
#define S2ENA 4
#define SerialDataBits 9600
void setup()
{
Serial.begin(115200);
Serial485Max.begin(SerialDataBits, SERIAL_8N1, S2RX, S2TX);
pinMode(S2ENA, OUTPUT);
delay(100);
digitalWrite(S2ENA, HIGH);
}
void loop()
{
int i;
for (i=0; i<1000; i++) {
Serial485Max.print(i);
Serial.print(i);
Serial.print('.');
delay(100);
}
}
Code: Select all
#include <HardwareSerial.h>
HardwareSerial Serial485Max(2);
#define S2RX 16
#define S2TX 17
#define S2ENA 4
#define SerialDataBits 9600
void setup()
{
Serial.begin(115200);
Serial485Max.begin(SerialDataBits, SERIAL_8N1, S2RX, -1, true);
delay(500);
Serial.println("serial ready");
}
void loop()
{
int sb;
char oc;
while (Serial485Max.available()) {
oc = Serial485Max.read();
Serial.print(oc);
Serial.print('.');
}
}