Im wanting to use SoftI2C to connect 2 arduino Unos together.
I need all analogue pins for other use in program so i need to change to different pins from analogue 4&5 (the hardware SCL/SDA lines on the uno)
the code i am using is the wire master/slave examples.
where wire allows the setting of an address to listen to and master writes to it
im not 100% sure how this is done using SoftI2C.
Ie. Wire.begin(4); // join i2c bus with address #4
Wire.begin(4); // join i2c bus with address #4
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
while(1 < Wire.available()) // loop through all but the last
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
int x = Wire.read(); // receive byte as an integer
Serial.println(x); // print the integer
Wire.begin(); // join i2c bus (address optional for master)
byte x = 0;
Wire.beginTransmission(4); // transmit to device #4
Wire.write("x is "); // sends five bytes
Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting
A simple straight forward example code for a SoftI2C approach to bothe the master and slave above would be very much appreciated.