Skip to content

Commit

Permalink
Update bbn_m5atomS3_lite_AS3935_lightning.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrouch authored Nov 13, 2024
1 parent c79bc54 commit f3107fb
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ void setup() {

pinMode(lightningInt, INPUT); // When lightning is detected the interrupt pin goes HIGH.

Wire.begin();
Wire.begin();
if ( !lightning.begin(Wire) ) {
Serial.println("Lightning Detector did not start!");
//Serial.println("Lightning Detector did not start!");
while (1);
}

Expand Down Expand Up @@ -56,13 +56,8 @@ void loop() {
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!");
long lightning_energy = lightning.lightningEnergy();
Serial.print("Lightning Energy: ");
Serial.println(lightning_energy);
gen_nmea0183_xdr("$BBXDR,D,%.0f,M,LIGHTNING_RANGE", (float)lightning.distanceToStorm() * 1000.0);
gen_nmea0183_xdr("$BBXDR,X,%.0f,,LIGHTNING_LEVEL", (float)lightning.lightningEnergy());
}
}
delay(100);
Expand Down

0 comments on commit f3107fb

Please sign in to comment.