user11116: Has someone experience with interfacing the AS3935 lightning sensor using I2C? I found a library but it only works with SPI as far as I can tell. I really don't want to give up 4 pins for SPI as I need those for other things. I2C would be great as I use a couple more sensors with I2C so no extra pins only for AS3935.

user41439: Just use these functions to read/write AS3935 registers, replacing the SPI ones (_devAddr is the device address, usually 0x03) :
// read/write functions for I2C mode
uint8_t AS3935::_i2cRead(uint8_t addr)
{
    // send register number
    Wire.beginTransmission(_devAddr);
    Wire.write(addr);
    Wire.endTransmission(false); // <<<--- THE 'false' here is mandatory!

    // request register data
    Wire.requestFrom(_devAddr, (uint8_t)1);

    // read data
    return Wire.read();
}

void AS3935::_i2cWrite(uint8_t addr, uint8_t data)
{
    Wire.beginTransmission(_devAddr);
    Wire.write(addr);
    Wire.write(data);
    Wire.endTransmission();
}

The "trick" is to use Wire.endTransmission(false) inside the read routine; this avoid to send the stop bit, which is mandatory for AS3935 read operation.

11116: <p>Has someone experience with interfacing the AS3935 lightning sensor using I2C? I found a library but it only works with SPI as far as I can tell. I really don't want to give up 4 pins for SPI as I need those for other things. I2C would be great as I use a couple more sensors with I2C so no extra pins only for AS3935.</p>
 41439: <p>Just use these functions to read/write AS3935 registers, replacing the SPI ones (_devAddr is the device address, usually 0x03) :</p>

<pre><code>// read/write functions for I2C mode
uint8_t AS3935::_i2cRead(uint8_t addr)
{
    // send register number
    Wire.beginTransmission(_devAddr);
    Wire.write(addr);
    Wire.endTransmission(false); // &lt;&lt;&lt;--- THE 'false' here is mandatory!

    // request register data
    Wire.requestFrom(_devAddr, (uint8_t)1);

    // read data
    return Wire.read();
}

void AS3935::_i2cWrite(uint8_t addr, uint8_t data)
{
    Wire.beginTransmission(_devAddr);
    Wire.write(addr);
    Wire.write(data);
    Wire.endTransmission();
}
</code></pre>

<p>The "trick" is to use Wire.endTransmission(false) inside the read routine; this avoid to send the stop bit, which is mandatory for AS3935 read operation.</p>
