Another user thought it might be usefull for me to post the code I used to solve this problem. There is not very much relevant code, but I guess for a newbee like myself, it might be helpfull. The more experienced users may find ways I could have done this better,but at least I know it works.
The goal was to pass a value 0 thrugh 5 from the atmega328 to the attiny85 so that the attiny counld take some action. The value, I guess could have been any value between 0 and 255, but I just needed the six above. This code will show how I did it but not why. This was just to test the ability to make these two talk to each other.
On the atmega328p (uno or mini)....
#include <Wire.h>
void setup()
{
// initialize the attiny with a starting value Wire.beginTransmission(38); // transmit to device 38 -- should match only one slave.
Wire.begin(); // join i2c bus (address optional for master)
Wire.write(5); // sends a byte
Wire.endTransmission(); // stop transmitting
}
void loop()
{
for (int i=0; i<6; i++) {
Wire.beginTransmission(38); // transmit to device #38
Wire.write(i); // sends mode as 0 - 5
Wire.endTransmission(); // stop transmitting
delay(1000);
}
}
on the Attiny....
#include "TinyWireS.h"
#define I2C_SLAVE_ADDR 0x26 // i2c slave address (38) -- the number is a bit arbitrary, but needs to be unique on the network.
int recvd;
void setup() {
TinyWireS.begin(I2C_SLAVE_ADDR); // init I2C Slave lightMode
}
void loop() {
// these lines will be used to retrieve a byte (0 - 5) once I can get this to work
if (TinyWireS.available()) {
recvd=TinyWireS.receive();
// take some action with the value in recvd.
}
}
I used a 4k7 pullup on attiny 5 and 7 and attached them to arduino A4 and A5 respectively. Of course both processors shared ground and 5v