I want set up an arduino board as an I2C client with wire.begin(stationNumber)
I also want to change the pins to non standard using E.g. wire.begin(D3,D4)
will wire.begin() accept 3 parameters for a client?
I want set up an arduino board as an I2C client with wire.begin(stationNumber)
I also want to change the pins to non standard using E.g. wire.begin(D3,D4)
will wire.begin() accept 3 parameters for a client?
What Arduino board? Some will allow specification of the I2C pins, some will not.
Both server and slave are lolin v3 boards, but I might switch to a nano 33 iot for the server once I get my code developed
The ESP8266 with the Wire library will allow one to specify the I2C pins in the begin function.
Wire.begin(SDApin, SCLpin); // master
Wire.begin(SDApin, SCLpin, address); // slave
The default I2C pins are pin 4 =SDA, pin 5=SCL.
I am totally unfamiliar with the SAMD21boards.
ah, so the address comes as the 3rd parameter, or if no SDA or SCL it can be the first parameter. I had not seen that documented anywhere. Thank you
The source code for the ESP8266 Wire library, Wire.h. Look at lines 56 and 57.
The address is only included for the slave. If using the default I2C pins with a master it is just:
Wire.begin();
There are many problems when using the I2C bus between Arduino boards on this forum. Expect a lot of trouble. The I2C bus is not a good choice as a communication bus between Arduino boards.
The Arduino Uno in Slave mode works well. So if you have two Arduino Uno board, directly next to each other, and if you keep the code in the interrupt routine very short and fast and if you don't use libraries that turn off interrupts, then it might work.
Everything else might fail.
Thank you for the advice.
I have hit the many problems with web server/client and UDP hangs/freezes so I was hoping a simple 2 wire solution would be easier.
Two tin cans and a length of string might be my next option. Lol
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.