![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
basic lightning detector with gps and sd card logging
Dependencies: AS3935 AdafruitGPS SDFileSystem TSI mbed ConfigFile
Diff: main.cpp
- Revision:
- 12:7c58c7a6b25c
- Parent:
- 10:499140eb469b
- Parent:
- 11:a4096e656762
- Child:
- 13:3d717008645c
--- a/main.cpp Wed Jul 01 19:03:20 2015 +0000 +++ b/main.cpp Wed Jul 01 19:39:05 2015 +0000 @@ -9,7 +9,7 @@ #include "time.h" #include <string> -#define FW_VER 3 +#define FW_VER 4 // frdm-kl25z as3935 connections for spi1 // ------------------------------------------------ @@ -76,6 +76,9 @@ void DetectLightning() { + /* After the signal IRQ goes high the external + unit should wait 2ms before reading the interrupt register. */ + wait_ms(2); OriginInt = ld.interruptSource(); gDistance = ld.lightningDistanceKm(); energy = ld.getEnergy(); @@ -113,7 +116,7 @@ // write to the current log file char time_str[32]; time_t seconds = time(NULL); - seconds -= 14400; // 14400 = 60*60*4, kludgy way of setting edt + seconds -= 14400; // 14400 = 60*60*4, kludgy way of setting est struct tm *tminfo = localtime(&seconds); strftime(time_str, 32, "%m/%d/%Y,%T", tminfo); fprintf(fp,"%s,%ld,",time_str,seconds);