pinMode(lightningInt, INPUT);
//Initialization for weather meter
pinMode(WSPEED, INPUT_PULLUP); //Input from wind meters windspeed sensor
pinMode(RAIN, INPUT_PULLUP); //Input from wind meters rain gauge sensor
//attach external interrupt pins to IRQ functions
attachInterrupt(digitalPinToInterrupt(RAIN), rainIRQ, FALLING);
attachInterrupt(digitalPinToInterrupt(WSPEED), wspeedIRQ, FALLING);
//turn on interrupts
interrupts();
if(lightning.beginSPI(spiCS, 2000000) == false){
Serial.println ("Lightning Detector did not start up, freezing!");
while(1);
}
else
Serial.println("Schmow-ZoW, Lightning Detector Ready!");
// The lightning detector defaults to an indoor setting at
// the cost of less sensitivity, if you plan on using this outdoors
// uncomment the following line:
lightning.setIndoorOutdoor(OUTDOOR);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
Serial.println();
Serial.print("Temperature: ");
Serial.println(tempSensor.readTempF(), 2);
Serial.print("Humidity: ");
Serial.println(tempSensor.readFloatHumidity(), 0);
Serial.print("Pressure: ");
Serial.println(tempSensor.readFloatPressure(), 0);
Serial.print("Altitude: ");
Serial.println(tempSensor.readFloatAltitudeFeet(), 1);
Serial.print("UV A, B, index: ");
Serial.println(String(uv.uva()) + ", " + String(uv.uvb()) + ", "+ String(uv.index()));
Serial.print("Soil Moisture = ");
Serial.println(readSoil());
Serial.print("Wind direction: ");
Serial.print(getWindDirection());
Serial.println(" degrees");
//Check interrupt flags
if (rainFlag == true){
Serial.println("Rain click!");
rainFlag = false;
}
if (windFlag == true){
Serial.println("Wind click!");