Changing a slave's i2c address
Posted: Wed Feb 20, 2019 4:58 pm
Hi all,
Not strictly ESP8266 related, but here goes:
I am developing a piece of hardware, that has one master and many slaves on an i2c bus. I want to implement some sort of auto addressing on the i2c, so I have a relais that interrupts the i2c connection to the next module.
On startup, the slave takes address 127, and gets its address from the master on that address. I noticed that the Wire library does not offer an end() method, so I'm wondering how I can change the address and what happens if I just call the begin() method again with the address?
Calling begin() twice seems to compile and run just fine, but will it:
listen on both its address and 127, just its address or just 127?
Unfortunately, I don't have any hardware to test that out yet.
Also, if there's a better way of auto addressing, I'm happy to hear it.
Thanks in advance for you input!
Not strictly ESP8266 related, but here goes:
I am developing a piece of hardware, that has one master and many slaves on an i2c bus. I want to implement some sort of auto addressing on the i2c, so I have a relais that interrupts the i2c connection to the next module.
On startup, the slave takes address 127, and gets its address from the master on that address. I noticed that the Wire library does not offer an end() method, so I'm wondering how I can change the address and what happens if I just call the begin() method again with the address?
Calling begin() twice seems to compile and run just fine, but will it:
listen on both its address and 127, just its address or just 127?
Unfortunately, I don't have any hardware to test that out yet.
Also, if there's a better way of auto addressing, I'm happy to hear it.
Thanks in advance for you input!