![]() The I2C library only provides master functionality. Combining two libraries for the same hardware isn't that trivial. But since both libraries use the same hardware, this cannot be divided between them. From the code I guess you wanted the Wire library to do the slaves job and the I2C library to implement the master. You cannot use the I2C library and the Wire library at the same time. What do I need to do to be able to send from two units using this library? loops, until all received bytes are read config Wire library for I2C slave functionality I2c.pullup(true) // done by external 4.7kOhm resistors Uint8_t rel_address = 10 // CHANGE FOR EVERY MODULE!! SET to own_address if relay is connected to this chip! rel_address = address of relay to switch SET to own_address if relay is connected to this chip! Uint8_t own_address = 11 // CHANGE FOR EVERY MODULE!! Sending data is done by pressing a button on pin 2 (switchPin) /** The only difference is that I switch the values of rel_address and own_address when programming the seconds Arduino. This is the used sketch for both the Arduino's. After that even sending data from the initial Arduino results in error 32. The other receives the data.īut when I sequentially try to send data from the second Arduino to the first, I get an error (32). Sending data from one Arduino to the other works fine. My sketch works as long as I use only one master. I created a setup with two Arduino nano's which act both as master and slave. I am developing a multi-master scenario sketch with the library, because this library will handle multi-master data collisions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |