![](/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
main.cpp@0:3328df4c3116, 2015-06-19 (annotated)
- Committer:
- ftagius
- Date:
- Fri Jun 19 11:29:59 2015 +0000
- Revision:
- 0:3328df4c3116
- Child:
- 1:10d2a051285e
first pass integrating lightning sensor with gps and logging
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ftagius | 0:3328df4c3116 | 1 | #include "mbed.h" |
ftagius | 0:3328df4c3116 | 2 | #include "GPS.h" |
ftagius | 0:3328df4c3116 | 3 | #include "main.h" |
ftagius | 0:3328df4c3116 | 4 | #include "TSISensor.h" |
ftagius | 0:3328df4c3116 | 5 | #include "SDFileSystem.h" |
ftagius | 0:3328df4c3116 | 6 | #include "AS3935.h" |
ftagius | 0:3328df4c3116 | 7 | |
ftagius | 0:3328df4c3116 | 8 | // frdm-kl25z sd card connections for spi1 |
ftagius | 0:3328df4c3116 | 9 | // ------------------------------------------------ |
ftagius | 0:3328df4c3116 | 10 | // Header -- kl25z -- SD/MMC |
ftagius | 0:3328df4c3116 | 11 | // J2-20 -- PTE1 -- MOSI |
ftagius | 0:3328df4c3116 | 12 | // J9-13 -- PTE4 -- CS |
ftagius | 0:3328df4c3116 | 13 | // J2-14 -- GND -- Vss (GND) |
ftagius | 0:3328df4c3116 | 14 | // J9-9 -- PTE2 -- SCK |
ftagius | 0:3328df4c3116 | 15 | // J9-11 -- PTE3 -- MISO |
ftagius | 0:3328df4c3116 | 16 | |
ftagius | 0:3328df4c3116 | 17 | AS3935 ld(PTE1, PTE3, PTE2, PTE4, "ld", 1000000); // MOSI, MISO, SCK, CS, SPI bus freq (hz) |
ftagius | 0:3328df4c3116 | 18 | InterruptIn IntLightning(PTA12); //IRQ AS3935 |
ftagius | 0:3328df4c3116 | 19 | |
ftagius | 0:3328df4c3116 | 20 | |
ftagius | 0:3328df4c3116 | 21 | // frdm-kl25z sd card connections spi0 |
ftagius | 0:3328df4c3116 | 22 | // ------------------------------------------------ |
ftagius | 0:3328df4c3116 | 23 | // Header -- kl25z -- SPI |
ftagius | 0:3328df4c3116 | 24 | // J2-8 -- PTD2 -- MOSI |
ftagius | 0:3328df4c3116 | 25 | // J2-6 -- PTD0 -- CS |
ftagius | 0:3328df4c3116 | 26 | // J9-12 -- GND -- Vss (GND) |
ftagius | 0:3328df4c3116 | 27 | // J9-4 -- P3V3 -- Vdd (+3.3v) |
ftagius | 0:3328df4c3116 | 28 | // J2-12 -- PTD1 -- SCK |
ftagius | 0:3328df4c3116 | 29 | // J9-14 -- GND -- Vss (GND) |
ftagius | 0:3328df4c3116 | 30 | // J2-10 -- PTD3 -- MISO |
ftagius | 0:3328df4c3116 | 31 | |
ftagius | 0:3328df4c3116 | 32 | SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd"); // MOSI, MISO, SCK, CS |
ftagius | 0:3328df4c3116 | 33 | |
ftagius | 0:3328df4c3116 | 34 | Serial pc(USBTX, USBRX); |
ftagius | 0:3328df4c3116 | 35 | GPS gpsd(PTE20, PTE21); |
ftagius | 0:3328df4c3116 | 36 | DigitalOut red(LED_RED); |
ftagius | 0:3328df4c3116 | 37 | DigitalOut green(LED_GREEN); |
ftagius | 0:3328df4c3116 | 38 | //DigitalOut blue(LED_BLUE); don't use the blue led, due to a board error, writing to the blue led kills spi |
ftagius | 0:3328df4c3116 | 39 | bool debug; |
ftagius | 0:3328df4c3116 | 40 | //bool gpsEnabled = true; |
ftagius | 0:3328df4c3116 | 41 | int day, month,year,hour,minute,seconds; |
ftagius | 0:3328df4c3116 | 42 | void writeLogFile(int distance); |
ftagius | 0:3328df4c3116 | 43 | //char logFile[]="lightning_data.csv"; |
ftagius | 0:3328df4c3116 | 44 | |
ftagius | 0:3328df4c3116 | 45 | void DetectLightning() |
ftagius | 0:3328df4c3116 | 46 | { |
ftagius | 0:3328df4c3116 | 47 | int OriginInt; |
ftagius | 0:3328df4c3116 | 48 | wait_ms(2); // |
ftagius | 0:3328df4c3116 | 49 | OriginInt = ld.interruptSource(); |
ftagius | 0:3328df4c3116 | 50 | pc.printf("%02d/%02d/20%02d_%02d:%02d:%02d ",month,day,year,hour,minute,seconds); |
ftagius | 0:3328df4c3116 | 51 | switch (OriginInt) |
ftagius | 0:3328df4c3116 | 52 | { |
ftagius | 0:3328df4c3116 | 53 | case 1: |
ftagius | 0:3328df4c3116 | 54 | pc.printf("Noise level too high\r\n"); |
ftagius | 0:3328df4c3116 | 55 | break; |
ftagius | 0:3328df4c3116 | 56 | case 4: |
ftagius | 0:3328df4c3116 | 57 | pc.printf("Disturber\r\n"); |
ftagius | 0:3328df4c3116 | 58 | writeLogFile(-1); // use -1 for distance to distinguish disturbances from strikes |
ftagius | 0:3328df4c3116 | 59 | break; |
ftagius | 0:3328df4c3116 | 60 | case 8: |
ftagius | 0:3328df4c3116 | 61 | int distance = ld.lightningDistanceKm(); |
ftagius | 0:3328df4c3116 | 62 | pc.printf("Lightning detection, distance=%dkm\r\n", distance); |
ftagius | 0:3328df4c3116 | 63 | writeLogFile(distance); |
ftagius | 0:3328df4c3116 | 64 | ld.clearStats(); |
ftagius | 0:3328df4c3116 | 65 | break; |
ftagius | 0:3328df4c3116 | 66 | default: |
ftagius | 0:3328df4c3116 | 67 | pc.printf("unknown interrupt %d\r\n", OriginInt); |
ftagius | 0:3328df4c3116 | 68 | |
ftagius | 0:3328df4c3116 | 69 | } |
ftagius | 0:3328df4c3116 | 70 | |
ftagius | 0:3328df4c3116 | 71 | } |
ftagius | 0:3328df4c3116 | 72 | |
ftagius | 0:3328df4c3116 | 73 | void writeLogFile(int distance) |
ftagius | 0:3328df4c3116 | 74 | { |
ftagius | 0:3328df4c3116 | 75 | char logFile[128]; |
ftagius | 0:3328df4c3116 | 76 | char directory[]="/sd/lightning_data"; |
ftagius | 0:3328df4c3116 | 77 | static bool header=false; |
ftagius | 0:3328df4c3116 | 78 | FILE *fp; |
ftagius | 0:3328df4c3116 | 79 | // create a log file name with the current date/time stamp |
ftagius | 0:3328df4c3116 | 80 | //sprintf(logFile, "%s%s%02d_%02d_20%02d_%02d_%02d_%02d.csv", directory,"/gps_",gpsd.month,gpsd.day,gpsd.year,gpsd.hour,gpsd.minute,gpsd.seconds); |
ftagius | 0:3328df4c3116 | 81 | sprintf(logFile, "%s%s", directory,"/lightning_data.csv"); |
ftagius | 0:3328df4c3116 | 82 | |
ftagius | 0:3328df4c3116 | 83 | sd.mount(); |
ftagius | 0:3328df4c3116 | 84 | fp = fopen(logFile, "a"); |
ftagius | 0:3328df4c3116 | 85 | if(fp == NULL) { |
ftagius | 0:3328df4c3116 | 86 | // retry |
ftagius | 0:3328df4c3116 | 87 | wait_ms(500); |
ftagius | 0:3328df4c3116 | 88 | fp = fopen(logFile, "a"); |
ftagius | 0:3328df4c3116 | 89 | if (fp == NULL) |
ftagius | 0:3328df4c3116 | 90 | { |
ftagius | 0:3328df4c3116 | 91 | error("Could not open file %s for writing\r\n",logFile); |
ftagius | 0:3328df4c3116 | 92 | sd.unmount(); |
ftagius | 0:3328df4c3116 | 93 | return; |
ftagius | 0:3328df4c3116 | 94 | } |
ftagius | 0:3328df4c3116 | 95 | } |
ftagius | 0:3328df4c3116 | 96 | pc.printf("Opened log file %s\r\n",logFile); |
ftagius | 0:3328df4c3116 | 97 | // write the log file header |
ftagius | 0:3328df4c3116 | 98 | if (header == false) |
ftagius | 0:3328df4c3116 | 99 | { |
ftagius | 0:3328df4c3116 | 100 | fprintf(fp,"# date,time,raw timestamp,latitude,longitude,distance\r\n"); |
ftagius | 0:3328df4c3116 | 101 | header = true; |
ftagius | 0:3328df4c3116 | 102 | } |
ftagius | 0:3328df4c3116 | 103 | // write to the current log file |
ftagius | 0:3328df4c3116 | 104 | fprintf(fp,"%02d/%02d/20%02d,", gpsd.month, gpsd.day, gpsd.year); |
ftagius | 0:3328df4c3116 | 105 | fprintf(fp,"%02d:%02d:%02d,", gpsd.hour, gpsd.minute, gpsd.seconds); |
ftagius | 0:3328df4c3116 | 106 | fprintf(fp,"%7.0f,",gpsd.timef); |
ftagius | 0:3328df4c3116 | 107 | fprintf(fp,"%5.7f,%5.7f,", gpsd.lat_deg, gpsd.lon_deg); |
ftagius | 0:3328df4c3116 | 108 | fprintf(fp,"%d",distance); |
ftagius | 0:3328df4c3116 | 109 | fprintf(fp,"\r\n"); |
ftagius | 0:3328df4c3116 | 110 | fflush(fp); |
ftagius | 0:3328df4c3116 | 111 | f_sync((FIL*)fp); |
ftagius | 0:3328df4c3116 | 112 | fclose(fp); |
ftagius | 0:3328df4c3116 | 113 | sd.unmount(); |
ftagius | 0:3328df4c3116 | 114 | } |
ftagius | 0:3328df4c3116 | 115 | |
ftagius | 0:3328df4c3116 | 116 | int main() |
ftagius | 0:3328df4c3116 | 117 | { |
ftagius | 0:3328df4c3116 | 118 | bool debug=false; |
ftagius | 0:3328df4c3116 | 119 | char directory[]="/sd/lightning_data"; |
ftagius | 0:3328df4c3116 | 120 | char c; |
ftagius | 0:3328df4c3116 | 121 | Timer refresh_Timer; //sets up a timer for use in loop; how often do we print GPS info? |
ftagius | 0:3328df4c3116 | 122 | const int refresh_Time = 1000; //refresh time in ms |
ftagius | 0:3328df4c3116 | 123 | TSISensor tsi; // touch slider |
ftagius | 0:3328df4c3116 | 124 | unsigned long measFreq; |
ftagius | 0:3328df4c3116 | 125 | pc.baud(9600); |
ftagius | 0:3328df4c3116 | 126 | // initializations for gps |
ftagius | 0:3328df4c3116 | 127 | green = 1; |
ftagius | 0:3328df4c3116 | 128 | gpsd.setBaud(9600); |
ftagius | 0:3328df4c3116 | 129 | gpsd.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA); |
ftagius | 0:3328df4c3116 | 130 | gpsd.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); |
ftagius | 0:3328df4c3116 | 131 | gpsd.sendCommand(PGCMD_ANTENNA); |
ftagius | 0:3328df4c3116 | 132 | gpsd.day=01; |
ftagius | 0:3328df4c3116 | 133 | gpsd.month=01; |
ftagius | 0:3328df4c3116 | 134 | gpsd.year=15; |
ftagius | 0:3328df4c3116 | 135 | gpsd.hour=1; |
ftagius | 0:3328df4c3116 | 136 | gpsd.minute=1; |
ftagius | 0:3328df4c3116 | 137 | gpsd.seconds=1; |
ftagius | 0:3328df4c3116 | 138 | red = 1; |
ftagius | 0:3328df4c3116 | 139 | green = 1; |
ftagius | 0:3328df4c3116 | 140 | pc.printf("Touch slider to start application\r\n"); |
ftagius | 0:3328df4c3116 | 141 | while(1) { |
ftagius | 0:3328df4c3116 | 142 | green = 1; // turn led off |
ftagius | 0:3328df4c3116 | 143 | wait_ms(200); |
ftagius | 0:3328df4c3116 | 144 | if (tsi.readPercentage()) |
ftagius | 0:3328df4c3116 | 145 | break; |
ftagius | 0:3328df4c3116 | 146 | green = 0; // turn led on |
ftagius | 0:3328df4c3116 | 147 | wait_ms(200); |
ftagius | 0:3328df4c3116 | 148 | if (tsi.readPercentage()) |
ftagius | 0:3328df4c3116 | 149 | break; |
ftagius | 0:3328df4c3116 | 150 | } |
ftagius | 0:3328df4c3116 | 151 | |
ftagius | 0:3328df4c3116 | 152 | pc.printf("\r\nstart lightning detector\r\n"); |
ftagius | 0:3328df4c3116 | 153 | //initializations for lightning detector |
ftagius | 0:3328df4c3116 | 154 | //initializations |
ftagius | 0:3328df4c3116 | 155 | ld.init(); |
ftagius | 0:3328df4c3116 | 156 | ld.clearStats(); |
ftagius | 0:3328df4c3116 | 157 | //ld.setTuneCap(5); // 500kHz |
ftagius | 0:3328df4c3116 | 158 | measFreq = ld.tuneAntenna(IntLightning); |
ftagius | 0:3328df4c3116 | 159 | ld.powerUp(); |
ftagius | 0:3328df4c3116 | 160 | ld.calibrateRCOs(IntLightning); |
ftagius | 0:3328df4c3116 | 161 | ld.setIndoors(); |
ftagius | 0:3328df4c3116 | 162 | //ld.setOutdoors(); |
ftagius | 0:3328df4c3116 | 163 | ld.setMinimumLightnings(0); |
ftagius | 0:3328df4c3116 | 164 | ld.setSpikeRejection(2); |
ftagius | 0:3328df4c3116 | 165 | ld.setNoiseFloor(2); |
ftagius | 0:3328df4c3116 | 166 | //ld.disableDisturbers(); |
ftagius | 0:3328df4c3116 | 167 | ld.enableDisturbers(); |
ftagius | 0:3328df4c3116 | 168 | ld.setWatchdogThreshold(4); |
ftagius | 0:3328df4c3116 | 169 | IntLightning.rise(&DetectLightning); |
ftagius | 0:3328df4c3116 | 170 | int MinBlysk = ld.getMinimumLightnings(); |
ftagius | 0:3328df4c3116 | 171 | int Noise = ld.getNoiseFloor(); |
ftagius | 0:3328df4c3116 | 172 | int TuneCap = ld.getTuneCap(); |
ftagius | 0:3328df4c3116 | 173 | int SpikeRej = ld.getSpikeRejection(); |
ftagius | 0:3328df4c3116 | 174 | int WatchDog = ld.getWatchdogThreshold(); |
ftagius | 0:3328df4c3116 | 175 | |
ftagius | 0:3328df4c3116 | 176 | pc.printf(" Min wylad: %i", MinBlysk); |
ftagius | 0:3328df4c3116 | 177 | pc.printf("\r\n"); |
ftagius | 0:3328df4c3116 | 178 | pc.printf(" Gain: 0x%02x\r\n",ld.getGain()); |
ftagius | 0:3328df4c3116 | 179 | pc.printf(" Noise: %i", Noise); |
ftagius | 0:3328df4c3116 | 180 | pc.printf("\r\n"); |
ftagius | 0:3328df4c3116 | 181 | pc.printf(" Tune CAP: %i", TuneCap); |
ftagius | 0:3328df4c3116 | 182 | pc.printf("\r\n"); |
ftagius | 0:3328df4c3116 | 183 | pc.printf(" Spike rej: %i", SpikeRej); |
ftagius | 0:3328df4c3116 | 184 | pc.printf("\r\n"); |
ftagius | 0:3328df4c3116 | 185 | pc.printf(" Watchdog: %i", WatchDog); |
ftagius | 0:3328df4c3116 | 186 | pc.printf("\r\n"); |
ftagius | 0:3328df4c3116 | 187 | pc.printf(" LCO calibration: %ld Hz\n\r", measFreq); |
ftagius | 0:3328df4c3116 | 188 | |
ftagius | 0:3328df4c3116 | 189 | |
ftagius | 0:3328df4c3116 | 190 | refresh_Timer.start(); //starts the clock on the timer |
ftagius | 0:3328df4c3116 | 191 | //Mount the filesystem |
ftagius | 0:3328df4c3116 | 192 | sd.mount(); |
ftagius | 0:3328df4c3116 | 193 | mkdir(directory, 0777); |
ftagius | 0:3328df4c3116 | 194 | bool gpsFix=false; |
ftagius | 0:3328df4c3116 | 195 | pc.printf("Starting GPS App\r\n"); |
ftagius | 0:3328df4c3116 | 196 | while (1) |
ftagius | 0:3328df4c3116 | 197 | { |
ftagius | 0:3328df4c3116 | 198 | c = gpsd.read(); //queries the GPS |
ftagius | 0:3328df4c3116 | 199 | if (debug) |
ftagius | 0:3328df4c3116 | 200 | { |
ftagius | 0:3328df4c3116 | 201 | if (c) { |
ftagius | 0:3328df4c3116 | 202 | printf("%c", c); //this line will echo the GPS data if not paused |
ftagius | 0:3328df4c3116 | 203 | continue; |
ftagius | 0:3328df4c3116 | 204 | } |
ftagius | 0:3328df4c3116 | 205 | } |
ftagius | 0:3328df4c3116 | 206 | |
ftagius | 0:3328df4c3116 | 207 | //check if we recieved a new message from GPS, if so, attempt to parse it, |
ftagius | 0:3328df4c3116 | 208 | if ( gpsd.newNMEAreceived() ) { |
ftagius | 0:3328df4c3116 | 209 | if ( !gpsd.parse(gpsd.lastNMEA()) ) { |
ftagius | 0:3328df4c3116 | 210 | continue; |
ftagius | 0:3328df4c3116 | 211 | } |
ftagius | 0:3328df4c3116 | 212 | } |
ftagius | 0:3328df4c3116 | 213 | |
ftagius | 0:3328df4c3116 | 214 | // update globals with the lastest gps time stamp |
ftagius | 0:3328df4c3116 | 215 | day=gpsd.day; |
ftagius | 0:3328df4c3116 | 216 | month=gpsd.month; |
ftagius | 0:3328df4c3116 | 217 | year=gpsd.year; |
ftagius | 0:3328df4c3116 | 218 | hour=gpsd.hour; |
ftagius | 0:3328df4c3116 | 219 | minute=gpsd.minute; |
ftagius | 0:3328df4c3116 | 220 | seconds=gpsd.seconds; |
ftagius | 0:3328df4c3116 | 221 | |
ftagius | 0:3328df4c3116 | 222 | //check if enough time has passed to warrant printing GPS info to screen |
ftagius | 0:3328df4c3116 | 223 | //note if refresh_Time is too low or pc.baud is too low, GPS data may be lost during printing |
ftagius | 0:3328df4c3116 | 224 | if (refresh_Timer.read_ms() >= refresh_Time) |
ftagius | 0:3328df4c3116 | 225 | { |
ftagius | 0:3328df4c3116 | 226 | if (gpsd.fix) { |
ftagius | 0:3328df4c3116 | 227 | // got a gps fix |
ftagius | 0:3328df4c3116 | 228 | if (gpsFix == false) |
ftagius | 0:3328df4c3116 | 229 | { |
ftagius | 0:3328df4c3116 | 230 | // first time fix obtained |
ftagius | 0:3328df4c3116 | 231 | gpsFix = true; |
ftagius | 0:3328df4c3116 | 232 | pc.printf("GPS fix obtained on %02d/%02d/20%02d_%02d:%02d:%02d (UTC)\r\n",gpsd.month,gpsd.day,gpsd.year,gpsd.hour,gpsd.minute,gpsd.seconds); |
ftagius | 0:3328df4c3116 | 233 | pc.printf("Touch slider to suspend application\r\n"); |
ftagius | 0:3328df4c3116 | 234 | pc.printf("Waiting for lighting detection...\r\n"); |
ftagius | 0:3328df4c3116 | 235 | } |
ftagius | 0:3328df4c3116 | 236 | |
ftagius | 0:3328df4c3116 | 237 | //red = 1; // turn led off |
ftagius | 0:3328df4c3116 | 238 | //pc.printf("turn green on\r\n"); |
ftagius | 0:3328df4c3116 | 239 | green = 0; // turn led on |
ftagius | 0:3328df4c3116 | 240 | wait_ms(50); |
ftagius | 0:3328df4c3116 | 241 | } |
ftagius | 0:3328df4c3116 | 242 | else |
ftagius | 0:3328df4c3116 | 243 | { |
ftagius | 0:3328df4c3116 | 244 | pc.printf("Waiting for GPS FIX\r\n"); |
ftagius | 0:3328df4c3116 | 245 | red = 0; // turn led on |
ftagius | 0:3328df4c3116 | 246 | } |
ftagius | 0:3328df4c3116 | 247 | |
ftagius | 0:3328df4c3116 | 248 | // restart the timer for the gps print loop |
ftagius | 0:3328df4c3116 | 249 | // writeLogFile(-2); |
ftagius | 0:3328df4c3116 | 250 | refresh_Timer.reset(); |
ftagius | 0:3328df4c3116 | 251 | } |
ftagius | 0:3328df4c3116 | 252 | else |
ftagius | 0:3328df4c3116 | 253 | { |
ftagius | 0:3328df4c3116 | 254 | //red = 0; // turn led on |
ftagius | 0:3328df4c3116 | 255 | //pc.printf("turn green off\r\n"); |
ftagius | 0:3328df4c3116 | 256 | green = 1; // turn green led off |
ftagius | 0:3328df4c3116 | 257 | // check the slider. if touched, disable lighting interrupts and wait for another slider touch |
ftagius | 0:3328df4c3116 | 258 | if (tsi.readPercentage()) |
ftagius | 0:3328df4c3116 | 259 | { |
ftagius | 0:3328df4c3116 | 260 | IntLightning.disable_irq(); |
ftagius | 0:3328df4c3116 | 261 | pc.printf("Touch slider to continue application\r\n"); |
ftagius | 0:3328df4c3116 | 262 | while (1) |
ftagius | 0:3328df4c3116 | 263 | { |
ftagius | 0:3328df4c3116 | 264 | |
ftagius | 0:3328df4c3116 | 265 | green = 1; // turn led off |
ftagius | 0:3328df4c3116 | 266 | wait_ms(200); |
ftagius | 0:3328df4c3116 | 267 | // break of of the loop if the slider is touched |
ftagius | 0:3328df4c3116 | 268 | if (tsi.readPercentage()) |
ftagius | 0:3328df4c3116 | 269 | { |
ftagius | 0:3328df4c3116 | 270 | green = 1; |
ftagius | 0:3328df4c3116 | 271 | red = 1; |
ftagius | 0:3328df4c3116 | 272 | pc.printf("Now monitoring for lightning strikes\r\n"); |
ftagius | 0:3328df4c3116 | 273 | IntLightning.enable_irq(); |
ftagius | 0:3328df4c3116 | 274 | break; |
ftagius | 0:3328df4c3116 | 275 | } |
ftagius | 0:3328df4c3116 | 276 | green = 0; // turn led on |
ftagius | 0:3328df4c3116 | 277 | wait_ms(200); |
ftagius | 0:3328df4c3116 | 278 | // break of of the loop if the slider is touched |
ftagius | 0:3328df4c3116 | 279 | if (tsi.readPercentage()) |
ftagius | 0:3328df4c3116 | 280 | { |
ftagius | 0:3328df4c3116 | 281 | green = 1; |
ftagius | 0:3328df4c3116 | 282 | red = 1; |
ftagius | 0:3328df4c3116 | 283 | pc.printf("Now monitoring for lightning strikes\r\n"); |
ftagius | 0:3328df4c3116 | 284 | IntLightning.enable_irq(); |
ftagius | 0:3328df4c3116 | 285 | break; |
ftagius | 0:3328df4c3116 | 286 | } |
ftagius | 0:3328df4c3116 | 287 | |
ftagius | 0:3328df4c3116 | 288 | } // end while 1 for slider |
ftagius | 0:3328df4c3116 | 289 | } // end if tsi read |
ftagius | 0:3328df4c3116 | 290 | } // end else refresh timer |
ftagius | 0:3328df4c3116 | 291 | |
ftagius | 0:3328df4c3116 | 292 | } |
ftagius | 0:3328df4c3116 | 293 | |
ftagius | 0:3328df4c3116 | 294 | |
ftagius | 0:3328df4c3116 | 295 | |
ftagius | 0:3328df4c3116 | 296 | } |