Bidirectional communication from RS-232 to half-duplex RS-485 using arduino nano

You might have reasons to use a Nano but I would like to point out that the Nano Every has 4 UARTs. Two are part of the Arduino core (Serial and Serial1), the other two are a bit trickier. If you're not set on using a classic Nano but have the freedom to change to a Nano Every you can read e.g. Arduino Nano Every Serial Ports – Kevin's Blog.