Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple slaves on bus #156

Open
mesink opened this issue Apr 9, 2021 · 1 comment
Open

Support for multiple slaves on bus #156

mesink opened this issue Apr 9, 2021 · 1 comment

Comments

@mesink
Copy link

mesink commented Apr 9, 2021

ModbusMaster version: v2.0.1

Just wondering if there is any work in progress or plans to support multiple devices on the bus. I'll be looking to add this functionality and wanted to leverage any existing code.

@JoeEarlam
Copy link

This works in 2.0.1 using the setSlaveID() function:

void testRead(uint8_t addr) { node.setSlaveID(addr); if (node.readHoldingRegisters(17, 35) == node.ku8MBSuccess) { for (uint8_t j = 0; j < 35; j++) { data[j] = node.getResponseBuffer(j); Serial.print(j); Serial.print(": "); Serial.println(data[j]); } } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants