Modbust RTU slave adress change "on fly". How to do?

Hello.
I use Modbus Master Slave library from this source

Working very well. But now i nedd do this:
I have a set of dip switches (normally opened) connected to 5,6 7 out of Nano. I want do this:
At start i read condition of switches (in SETUP section or earlier (how?)). This swiches will set slave adress at binary (000=0,001=1 111=7) etc. And after that i start my MODBUS exchange.
Now with the library MODBUS objects with adress setting is created BEFORE setup section and i dont know how i can change adress.

How i can do this - dinnamycaly change slave adress (reset after dip switch canging is normal and acceptable for my task) ?

Thank you. Sorry my bad English.

Some ideas:

  1. Delay the construction until the slave address is known.
  2. Make u8id public.
  3. Add a u8id setter to the class.

Thank you. I'm stupid ass - at friday i dont found adress changing in library. Now - i found.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.