windFlag = false;
}
// Hardware has alerted us to an event, now we read the interrupt register
if(digitalRead(lightningInt) == HIGH){
intVal = lightning.readInterruptReg();
if(intVal == NOISE_INT){
Serial.println("Noise.");
// Too much noise? Uncomment the code below, a higher number means better
// noise rejection.
//lightning.setNoiseLevel(noise);
}
else if(intVal == DISTURBER_INT){
Serial.println("Disturber.");
// Too many disturbers? Uncomment the code below, a higher number means better
// disturber rejection.
//lightning.watchdogThreshold(disturber);
}
else if(intVal == LIGHTNING_INT){
Serial.println("Lightning Strike Detected!");
// Lightning! Now how far away is it? Distance estimation takes into
// account any previously seen events in the last 15 seconds.
byte distance = lightning.distanceToStorm();
Serial.print("Approximately: ");
Serial.print(distance);
Serial.println("km away!");
}
}
digitalWrite(LED_BUILTIN, LOW);
delay(3000);
}
int readSoil() {
int moistVal = 0;
//Power Senor
digitalWrite(soilPower, HIGH);
delay(10);
moistVal = analogRead(soilPin);
digitalWrite(soilPower, LOW); //Turn the sensor off
return moistVal; //Return current moisture value
}
int getWindDirection()
{
unsigned int adc;
adc = analogRead(WDIR); //get the current readings from the sensor
if (adc < 380) return (113);
if (adc < 393) return (68);
if (adc < 414) return (90);
if (adc < 456) return (158);
if (adc < 508) return (135);
// turn the LED off by making the voltage LOW
//Variable for storing moisture value
//Read the SIG value from sensor
Need help?
Do you have a question about the MicroMod SEN-16794 and is the answer not in the manual?
Questions and answers