Modbus for Nano

I am trying to learn how to use Modbus for Nano with LEDs. I got it working. I use this link RS485 MODBUS Serial Communication using Arduino UNO as Slave. I was able to add more LEDs and slave2 and got it working. Now I would like to add some buttons and sensors on Nano slave1 and slave 2 and be able to send the data to Simply Modbus Master. I am not sure how to do this to receive data from Arduino on buttons and Sensors from Simply Modbus Master. I just wish there is more examples on Modbus with Simply Modbus Master. Once I get that working then I will write a pascal program for Windows to send and received data from Arduino.

Your topic has been moved to a more suitable location on the forum. Introductory Tutorials is for tutorials that e.g. you write, not for questions. Feel free to write a tutorial once you have solved your problem :wink:

To read button states I would use FC2 Read Discrete Inputs.

To answer sensor data, you could either use FC4 Read input register or FC3 Read Multiple Holding register.

Some time ago I have written my own Modbus Server (modbus slave) library. If you want to give it a try - it has examples for all supported function codes:
https://werner.rothschopf.net/microcontroller/202112_arduino_modbus_server.htm