RS485 library by Gammon - not working for Arduino MEGA :(

sorry, now is working :slight_smile: !!!

I thought that it is necessary to change library but it alwys need to be:

const byte STX = '\2';
const byte ETX = '\3';

now is ok but slower... why it is slower? It is three times slower...

prepond:
of course I change everytime this two lines in library:

const byte STX = '\45';
const byte ETX = '\46';

Why? STX and ETX are not pin numbers.

You are changing the wrong thing. Please post your code.

Please use code tags.

Read this before posting a programming question

prepond:
it is working with software serial so why not?

Because it adds software overhead and uses extra memory and probably a timer resource.. You only use it if there are no other option.

prepond:
And question two, why such a combination? Because:

"Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69)."

You're missing my point :wink: If you use a hardware serial pin in software serial, you just as well could have used that hardware serial. It's possible that you use both software serial in your code as well as hardware serial in which case you have a conflict the way you did it. And that is why I wanted to see YOUR code with modifications and all.

prepond:
my code is exactly like on that page:

...

of course I change everytime this two lines in library:

const byte STX = '\45';
const byte ETX = '\46';

Exactly the same ... but with changes, huh?