ArduinoModbus
ArduinoModbus copied to clipboard
Cannot stop Modbus RTU communication
Hello, for few days I'm trying to solve this problem somehow but without any luck. I'm using Arduino Nano with connected TTLtoRS484 module. Arduino is connected to my laptop via USB cable. With you class I can read and write data to my modbus end device. The problem is that I cannot stop modbus connection after its started. I want to be able to read Serial inputs - like from Arduino IDE serial monitor like that:
if(Serial.available() > 0) { inputCommand = Serial.readStringUntil('\n'); Serial.println(inputCommand); }
I'm able to do this before calling:
ModbusRTUClient.begin(9600, SERIAL_8N1);
....but after above I cannot do anything - I used ModbusRTUClient.end(), I was trying to restart Serial communication by Serial.end(), but now i don't know what to do in order to make it work.
I know that in my case its hard to use Modbus connection and serial read from input, because I have just one serial TX/RX, so I was trying to use some softwareSerial libs, but without success (maybe i connected something wrong i dont know).
If for example there is a way for sending request via modbus, then close/pause connection and use Serial input for other things it would be great.
Do you think there can be solution for this ?