Hi,
I am sending "hello " from the Attiny85 when requested by the Arduino Mega (Master).
Only getting: "????`" which translates to 255 255 255 255 96. There is obviously something going wrong with the protocol. Tiny: Using TinyWireS (newer version of github which includes TinyWireS.onRequest). Checked Connections:
5V
SDA (MEGA 20/Tiny 5)
SCL (MEGA 21/Tiny 7)
GND
Theres also an I2C LCD hooked up in the circuit, but it should not matter (I tried multiple different adresses of Tiny)
I burned the internal 8mhz Bootloader.
Master:
#include <Wire.h>
void setup() {
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
}
void loop() {
Wire.requestFrom(0x4, 6); // request 6 bytes from slave device #8
while (Wire.available()) { // slave may send less than requested
//char c = Wire.read(); // receive a byte as character
Serial.println(Wire.read()); // print the character
}
delay(500);
}
Slave:
#define I2C_SLAVE_ADDRESS 0x4 // the 7-bit address (remember to change this when adapting this example)
// Get this from https://github.com/rambo/TinyWire
#include <TinyWireS.h>
void requestEvent()
{
TinyWireS.send("hello ");
}
void setup()
{
TinyWireS.begin(I2C_SLAVE_ADDRESS);
TinyWireS.onRequest(requestEvent);
}
void loop()
{
TinyWireS_stop_check();
}
Thanks for your help in advance