basic lightning detector with gps and sd card logging
Dependencies: AS3935 AdafruitGPS SDFileSystem TSI mbed ConfigFile
Diff: main.cpp
- Revision:
- 11:a4096e656762
- Parent:
- 9:15c9bf86d908
- Child:
- 12:7c58c7a6b25c
diff -r 15c9bf86d908 -r a4096e656762 main.cpp --- a/main.cpp Wed Jul 01 14:00:03 2015 +0000 +++ b/main.cpp Wed Jul 01 19:29:54 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 -= 14500; // 14400 = 60*60*4, kludgy way of setting est + 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);