30.09.2023, 15:02
(This post was last modified: 30.09.2023, 15:03 by Erwin van der Zwart.)
Looked quickly and noticed this already:
res, err = mb:readregisters(6, nappartamento)
Where nappartamento seems to be a value around 200 resulting in a command where you try to read register 6 to 206 at once and those 200 registers probably don’t even exist (consecutive), given the “res, err =“ you probably want to read only register 6..
I think your command needs to be:
res, err = mb:readregisters(6)
res, err = mb:readregisters(6, nappartamento)
Where nappartamento seems to be a value around 200 resulting in a command where you try to read register 6 to 206 at once and those 200 registers probably don’t even exist (consecutive), given the “res, err =“ you probably want to read only register 6..
I think your command needs to be:
res, err = mb:readregisters(6)