   ratio = 0;
 
   lastmillis = 0;
-  
-    Serial.print("Initializing SD card...");
+
+  Serial.print("Initializing SD card...");
   // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
   // Note that even if it's not used as the CS pin, the hardware SS pin 
   // (10 on most Arduino boards, 53 on the Mega) must be left as an output 
   // or the SD library functions will not work. 
   pinMode(10, OUTPUT);
- 
+
   if (!SD.begin(10)) {
     Serial.println("initialization failed!");
     return;
   }
   Serial.println("initialization done.");
- 
+
   // open the file. note that only one file can be open at a time,
   // so you have to close this one before opening another.
   file = SD.open("data.log", FILE_WRITE);
+
+  // I2C Slave configuration
+  Wire.begin(I2C_ADDRESS);                // join i2c bus with address #4
+  Wire.onRequest(requestEvent); // register event
 }
 
 /**


#include <SPI.h>
#include <SD.h>

#define ENGINE_PULSES_PER_REVOLUTION 3
#define WHEEL_PULSES_PER_REVOLUTION 5

#define TIME_LAPSE 100

volatile byte engine_pulses;
volatile byte wheel_pulses;

unsigned int engine_rpm;
unsigned int wheel_rpm;
float ratio;

unsigned long lastmillis;

File file;

void setup() {
  Serial.begin(9600);


    engine_rpm = (60/ENGINE_PULSES_PER_REVOLUTION)*1000/(current_time_lapse) * engine_pulses;
    wheel_rpm = (60/WHEEL_PULSES_PER_REVOLUTION)*1000/(current_time_lapse) * wheel_pulses;
    ratio = 100*engine_rpm/wheel_rpm;
    engine_pulses = 0;
    wheel_pulses = 0;

