Problem with I2C communication between ATTiny 85 and Raspberry pi

I am using Arduino IDE to program ATTiny and Arduino as a programmer.
The proble is when I use delay(1000); in void loop() after sending a number let's say 10 to Raspberry pi via I2C I get value as zero. When I do I2C detect it detects all the the addresses. When I remove delay(1000); it works perfectly fine. Please address my problem.

It's something to do with the code you didn't post.

HTH

AWOL:
I don't think you connected the grounds, Dave.

Did you connect the grounds together? Pulldown resistors? Pi Code? AVR code?

Sorry not much info to go by your post. :confused:

(deleted)

There is a bug or oversight in your code. Were you to post it, one of us might even be able to tell you where.

I was using TinyWireS library, now I used Wire.h library of arduino it is working on attiny as well.
Thanks for your support.

I am using this code to send two float type data via i2c from attiny85 to raspberry pi. I am not getting anything at raspberrypi side. Wire library works fine when I send just one byte of data.

Here is code for attiny85:

#include <Wire.h>

#define SLAVE_ADDRESS 0x04

#define FLOATS_SENT 2

float temperature = 10.5;
float luminosity = 5.2;
float data[FLOATS_SENT];

void setup() {
    pinMode(13, OUTPUT);
    Serial.begin(9600);
    
    data[0] = temperature;
    data[1] = luminosity;
    
    // initialize i2c as slave
    Wire.begin(SLAVE_ADDRESS);

    // define callbacks for i2c communication
    Wire.onRequest(sendData);
}

void loop() {
    delay(100);
}

void sendData(){
  Wire.write((byte*) &temperature, FLOATS_SENT*sizeof(float));
}

Raspberry pi code:

import struct
import smbus
# for RPI version 1, use "bus = smbus.SMBus(0)"
bus = smbus.SMBus(1)

# This is the address we setup in the Arduino Program
address = 0x04

def get_data():
    return bus.read_i2c_block_data(address, 0);

def get_float(data, index):
    bytes = data[4*index:(index+1)*4]
    return struct.unpack('f', "".join(map(chr, bytes)))[0]

while True:
    try:
        data = get_data()
        print(get_float(data, 0))
        print(get_float(data, 1))
    except:
        continue
    time.sleep(1);

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Threads merged.

A update on that, this part// struct.unpack('f', "".join(map(chr, bytes)))[0]// do have errors in python3 but It do not give any error in python2.
Now I am able to read float values but after reading 15 values there is an error:input/output error.
Now, I am struck again.
please help me.