 * Could be used alone or with Arduino DataLogger
 * Some information about interrupts:
 * - http://arduino.cc/en/Reference/attachInterrupt
+* About I2C:
+$ - WSWireLib: https://github.com/steamfire/WSWireLib
 * About SD Cards:
 * - https://learn.adafruit.com/adafruit-micro-sd-breakout-board-card-tutorial/format
 * Some useful information about Aprilia RSV/SL bikes work: (See: http://www.aprilia-v60.com/index.php?topic=262315)


    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 = engine_rpm/wheel_rpm;
    engine_pulses = 0;
    wheel_pulses = 0;



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

#define ENGINE_PULSES_PER_REVOLUTION 3
#define WHEEL_PULSES_PER_REVOLUTION 5

#define GEAR_RATIO_OFFSET 0.1

#define TIME_LAPSE 100

#define I2C_ADDRESS 4

volatile byte engine_pulses;
volatile byte wheel_pulses;

unsigned int engine_rpm;
unsigned int wheel_rpm;
unsigned int ratio;
unsigned int gear_ratio_table[6]; // ratio values for each gear

unsigned long lastmillis;

File file;


uint8_t i2c_values[6];


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