What could the problem be here?
Is Serial.print/Serial.write blocking so I can expect data to be transmitted when command is executed or do I have to expect it to do work after?
pls show up a clear picture of your wiring to see how you have connected the 485. Pull/up Pull/Downs, the 120Ohm resistor, DE/RE
by the way, this tutorial for general Arduino-Arduino RS communication is a pretty good starthttps://forum.arduino.cc/index.php?topic=396450.0
I agree with noiasca that a wiring diagram is necessary to analyze the situation. I guess that you forgot to put the RO pin in a defined state. While RE is low the MAX485 will control that pin but if RE is high the pin is left floating by the driver chip. In this case the pin may show any noise the surrounding area provides. A simple pull-up resistor may help.
The Serial object is doing it's work in a special interrupt, so the output you provide to print/write methods is just copied to an internal buffer and the method returns. If you want to block until all data is sent, use the flush() method.
See above. RE and DE are connected together to digital pin 10.
Btw. I'll try my code with an added flush command later on. Also I'm thinking about switching to the MAX491 chip using it to have one line for the master always sending and just have a shared return for all the slaves to send status reports.
I wrote "RO" not RE. RO is floating if RE is HIGH, so while you're sending out some bytes you're receiving random data. As the floating pin is near the sending pin you might catch up a faulty version of your sent data. In any case you get readings you cannot interpret correctly.
In that case you need the idle state fixation resistors for both pairs (pull-up/down for A and B), at least if don't let DE HIGH constantly.
I also put two 18 kOhm between GND and B as well as A and 5V
Should Pull-Up/Down be done on all members of the Bus or should one end be sufficient? Would expect the latter?
DE High all the time would only be true for the sending master when I switch to the MAX491, all slaves would share the return channel and answer the master if requested by their address on the shared bus variant. So there would be times without an active sender [most of the time actually])