       Serial.println("km away!"); 
     }
   }
-  delay(100);
+
+  delay(5000); // wait 5 seconds for the next I2C scan
 }
 
 void thunder_init()

int AS3935_noise = 2; // Value between 1-7 
int AS3935_disturber = 2; // Value between 1-10

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


  lightning.setIndoorOutdoor(AS3935_OUTDOOR); 
}

double TMP116_ReadTempSensor(void){
  uint8_t data[2]; 
  int16_t datac;

  Wire.beginTransmission(TMP116_address); 
  Wire.write(TMP116_temp_reg); 
  Wire.endTransmission(); 

  delay(10); 

  Wire.requestFrom(TMP116_address,2); 

  if(Wire.available() <= 2){  
    data[0] = Wire.read(); 
    data[1] = Wire.read(); 

    datac = ((data[0] << 8) | data[1]); 

    return datac*0.0078125; 
  }
}

void tmp116_init(){
  // Configuration Register: Default is 0x02, 0x20
  // 11:10 MOD[1:0]
  // 00: Continuous conversion (CC) - default
  // 01: Shutdown (SD)
  // 10: Continuous conversion (CC), same as 00 (reads back = 00)
  // 11: One-shot conversion (OS)
  // 9:7 CONV[2:0] http://www.ti.com/lit/ds/symlink/tmp116.pdf
  // 100: - default
  // 6:5 AVG[1:0]
  // 01: - default 
  // Default = 8 samples, 1 second
  i2cwrite(TMP116_address, TMP116_config_reg, 0x02, 0x20);  
}

double i2cwrite(int device_addr, int register_addr, int high_bytes, int low_bytes){
  Wire.beginTransmission(device_addr); 
  Wire.write(register_addr);
  Wire.write(high_bytes);
  Wire.write(low_bytes);
  Wire.endTransmission();
  delay(10);
}
