From c79bc54dee104caa06c825eca100400a4b20dc74 Mon Sep 17 00:00:00 2001 From: Mikhail Grushinskiy Date: Wed, 13 Nov 2024 18:02:13 -0500 Subject: [PATCH] Update bbn_m5atomS3_lite_AS3935_lightning.ino --- .../bbn_m5atomS3_lite_AS3935_lightning.ino | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/bbn_m5atomS3_lite_AS3935_lightning/bbn_m5atomS3_lite_AS3935_lightning.ino b/bbn_m5atomS3_lite_AS3935_lightning/bbn_m5atomS3_lite_AS3935_lightning.ino index 428267f..fbcd47e 100644 --- a/bbn_m5atomS3_lite_AS3935_lightning/bbn_m5atomS3_lite_AS3935_lightning.ino +++ b/bbn_m5atomS3_lite_AS3935_lightning/bbn_m5atomS3_lite_AS3935_lightning.ino @@ -26,10 +26,9 @@ void setup() { pinMode(lightningInt, INPUT); // When lightning is detected the interrupt pin goes HIGH. - Wire.begin(); // Begin Wire before lightning sensor. - - if ( !lightning.begin(Wire) ) { // Initialize the sensor. - Serial.println("Lightning Detector did not start up, freezing!"); + Wire.begin(); + if ( !lightning.begin(Wire) ) { + Serial.println("Lightning Detector did not start!"); while (1); } @@ -49,13 +48,9 @@ void loop() { uint8_t intVal = lightning.readInterruptReg(); if (intVal == NOISE_INT) { // Noise - // Too much noise? Uncomment the code below, a higher number means better noise rejection. - //lightning.setNoiseLevel(setNoiseLevel); } else if (intVal == DISTURBER_INT) { // Disturber - // Too many disturbers? Uncomment the code below, a higher number means better disturber rejection. - //lightning.watchdogThreshold(threshVal); } else if (intVal == LIGHTNING_INT) { Serial.println("Lightning Strike Detected!"); @@ -65,7 +60,6 @@ void loop() { Serial.print("Approximately: "); Serial.print(distance); Serial.println("km away!"); - long lightning_energy = lightning.lightningEnergy(); Serial.print("Lightning Energy: "); Serial.println(lightning_energy);