Data transfer via MAX485

I found a simple and useful code for Modbus RTU Slave Implementation on Arduino - Read Sensory Data and Save it to RTU Slave Registers. The code has the disadvantage that it is only connected to the Modbas simulator via the USB part on the Arduino board to the USB port on the computer. But I would like to make communication via the MAX485 module and to be able to use the elements with the specified code in any Modbus loop.
I am attaching the code that I would like to upgrade. The complete code with libraries is available on the website GitHub - brightersidetech/Arduino_Modbus_RTU: Implementation of Modbus RTU Slave and Master

// https://www.youtube.com/watch?v=nL-dR87dHOw

#include <ModbusRTUSlave.h>

ModbusRTUSlave modbus_slave(Serial);
const uint8_t slaveID = 1;
const uint32_t baud = 9600;

uint16_t holdingRegisters[20] = { 0 };

int sensor;

void setup() {
  // put your setup code here, to run once:
  modbus_slave.configureHoldingRegisters(holdingRegisters, 20);
  modbus_slave.begin(slaveID, baud, SERIAL_8N1);
}


void loop() {
  // put your main code here, to run repeatedly:
  sensor = analogRead(A1);
  //holdingRegisters[0] = sensor;
  holdingRegisters[0] = 325;
  holdingRegisters[1] = 227;

  modbus_slave.poll();
}

Would you edit your post to remove the typographical errors and wrap the code in < CODE > markup? I would not trust a post with so many errors. I will delete my post if you correct your post. : )

That's because your computer only has USB devices. In real life the UART will connect to the Modbus through the RS-485 transmitter (MAX485)..

That's my question. How do I add the MAX485 module in the code?

You connect the module to GND, RX, TX. I don't know how direction control (listen/send) is wired and handled in code by the library..