Home › Forums › Environmental Sensors › Using Modular Sensors for METER Teros 12 › Reply To: Using Modular Sensors for METER Teros 12
@srgdamiano I made a header and cpp file for the Teros 12 by copying the 11 files and adjusting them. When I try to use it, the outputs recorded to my SD card are all -9999 values, and the column headers for the variables are never added (but it will add the headers for the other variables besides the Teros). I get the same problem when I use the MeterTeros11 file, which I figured should still give me some results as it looks like it will just dump whatever is leftover in the data retrieval past the VWC counts and the temperature in the MeterTeros11.cpp file. Maybe I am using these objects incorrectly? Here is what I have for using the Teros11 class (the Teros sensors are at the bottom of my sensor objects):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
/** ========================================================================= * @file simple_logging.ino * @brief A simple data logging example. * * @author Sara Geleskie Damiano <sdamiano@stroudcenter.org> * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * * Build Environment: Visual Studios Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. * ======================================================================= */ // ========================================================================== // Include the libraries required for any data logger // ========================================================================== /** Start [includes] */ // The Arduino library is needed for every Arduino program. #include <Arduino.h> // EnableInterrupt is used by ModularSensors for external and pin change // interrupts and must be explicitly included in the main program. #include <EnableInterrupt.h> // Include the main header for ModularSensors #include <ModularSensors.h> /** End [includes] */ #include <AltSoftSerial.h> AltSoftSerial sonarSerial(6, -1); // ========================================================================== // Defines for the Arduino IDE // NOTE: These are ONLY needed to compile with the Arduino IDE. // If you use PlatformIO, you should set these build flags in your // platformio.ini // ========================================================================== /** Start [defines] */ //#ifndef TINY_GSM_RX_BUFFER //#define TINY_GSM_RX_BUFFER 64 //#endif //#ifndef TINY_GSM_YIELD_MS //#define TINY_GSM_YIELD_MS 2 //#endif //#ifndef MQTT_MAX_PACKET_SIZE //#define MQTT_MAX_PACKET_SIZE 240 //#endif /** End [defines] */ // ========================================================================== // Data Logging Options // ========================================================================== /** Start [logging_options] */ // The name of this program file const char* sketchName = "simple_logging_MaxBotix.ino"; // Logger ID, also becomes the prefix for the name of the data file on SD card const char* LoggerID = "22376"; // How frequently (in minutes) to log data const uint8_t loggingInterval = 1; // Your logger's timezone. const int8_t timeZone = -6; // Eastern Standard Time // NOTE: Daylight savings time will not be applied! Please use standard time! // Set the input and output pins for the logger // NOTE: Use -1 for pins that do not apply const int32_t serialBaud = 115200; // Baud rate for debugging const int8_t greenLED = 8; // Pin for the green LED const int8_t redLED = 9; // Pin for the red LED const int8_t buttonPin = 21; // Pin for debugging mode (ie, button pin) const int8_t wakePin = 31; // MCU interrupt/alarm pin to wake from sleep // Mayfly 0.x D31 = A7 // Set the wake pin to -1 if you do not want the main processor to sleep. // In a SAMD system where you are using the built-in rtc, set wakePin to 1 const int8_t sdCardPwrPin = -1; // MCU SD card power pin const int8_t sdCardSSPin = 12; // SD card chip select/slave select pin const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power /** End [logging_options] */ // ========================================================================== // Using the Processor as a Sensor // ========================================================================== /** Start [processor_sensor] */ #include <sensors/ProcessorStats.h> // Create the main processor chip "sensor" - for general metadata const char* mcuBoardVersion = "v1.1"; ProcessorStats mcuBoard(mcuBoardVersion); /** End [processor_sensor] */ // ========================================================================== // Maxim DS3231 RTC (Real Time Clock) // ========================================================================== /** Start [ds3231] */ #include <sensors/MaximDS3231.h> // Includes wrapper functions for Maxim DS3231 RTC // Create a DS3231 sensor object, using this constructor function: MaximDS3231 ds3231(1); /** End [ds3231] */ // ========================================================================== // MaxBotix sonar sensor for snow depth // ========================================================================== #include <sensors/MaxBotixSonar.h> const int32_t sonarHeight; const int8_t sonarPower = sensorPowerPin; const int8_t sonarTrigger = -1; const uint8_t sonarNumReadings = 3; MaxBotixSonar sonar(sonarSerial, sonarPower, sonarTrigger, sonarNumReadings); Variable* sonarRange = new MaxBotixSonar_Range(&sonar, "12345678-abcd-1234-ef00-1234567890ab"); float calculateSnowDepth(void) { float calculatedResult = -9999; // Always safest to start with a bad value float inputVar1 = sonarHeight; float inputVar2 = sonarRange->getValue(); // make sure both inputs are good if (inputVar1 != -9999 && inputVar2 != -9999) { calculatedResult = inputVar1 - inputVar2; } return calculatedResult; } // Properties of the calculated snow depth // The number of digits after the decimal place const uint8_t calculatedSnowDepthResolution = 0; // This must be a value from http://vocabulary.odm2.org/variablename/ const char* calculatedSnowDepthName = "Snow Depth"; // This must be a value from http://vocabulary.odm2.org/units/ const char* calculatedSnowDepthUnit = "mm"; // A short code for the variable const char* calculatedSnowDepthCode = "SNWD"; // The (optional) universallly unique identifier const char* calculatedSnowDepthUUID = "12345678-abcd-1234-ef00-1234567890ab"; Variable* calculatedSnowDepth = new Variable( calculateSnowDepth, calculatedSnowDepthResolution, calculatedSnowDepthName, calculatedSnowDepthUnit, calculatedSnowDepthCode, calculatedSnowDepthUUID); // ========================================================================== // Apogee sensors // ========================================================================== // Adafruit ADC voltage header file #include <sensors/TIADS1x15.h> #define boardADSi2cAddress 0x48 #define extraADSi2cAddress 0x49 const uint8_t apogeeNumReadings = 50; // How many readings to average for the apogee pyranometers and pyrgeometers float adsGain = 1; // ========================================================================== // Apogee SP-510-SS for incoming shortwave radiation // ========================================================================== const int8_t sp510Power = sensorPowerPin; const uint8_t sp510adsChannel = 2; TIADS1x15 sp510(sp510Power, sp510adsChannel, adsGain, boardADSi2cAddress, apogeeNumReadings); Variable* sp510Voltage = new TIADS1x15_Voltage(&sp510, "12345678-abcd-1234-ef00-1234567890ab"); const float sp510Calibration = 22; float calculateInShortRad(void) { float calculatedResult = -9999; // Always safest to start with a bad value float inputVar1 = sp510Voltage->getValue(); // make sure both input is good if (inputVar1 != -9999) { calculatedResult = inputVar1 * 1000 * sp510Calibration; } return calculatedResult; } // Properties of the calculated incoming shortwave radiation // The number of digits after the decimal place const uint8_t calculatedInShortRadResolution = 2; // This must be a value from http://vocabulary.odm2.org/variablename/ const char* calculatedInShortRadName = "Radiation, incoming shortwave"; // This must be a value from http://vocabulary.odm2.org/units/ const char* calculatedInShortRadUnit = "W/m^2"; // A short code for the variable const char* calculatedInShortRadCode = "ISWR"; // The (optional) universallly unique identifier const char* calculatedInShortRadUUID = "12345678-abcd-1234-ef00-1234567890ab"; Variable* radiationIncomingShortwave = new Variable( calculateInShortRad, calculatedInShortRadResolution, calculatedInShortRadName, calculatedInShortRadUnit, calculatedInShortRadCode, calculatedInShortRadUUID); // ========================================================================== // Apogee SP-610-SS for outgoing shortwave radiation // ========================================================================== const int8_t sp610Power = sensorPowerPin; const uint8_t sp610adsChannel = 3; TIADS1x15 sp610(sp610Power, sp610adsChannel, adsGain, boardADSi2cAddress, apogeeNumReadings); Variable* sp610Voltage = new TIADS1x15_Voltage(&sp610, "12345678-abcd-1234-ef00-1234567890ab"); const float sp610Calibration = 28.5; float calculateOutShortRad(void) { float calculatedResult = -9999; // Always safest to start with a bad value float inputVar1 = sp610Voltage->getValue(); // make sure both input is good if (inputVar1 != -9999) { calculatedResult = inputVar1 * 1000 * sp610Calibration; } return calculatedResult; } // Properties of the calculated outgoing shortwave radiation // The number of digits after the decimal place const uint8_t calculatedOutShortRadResolution = 2; // This must be a value from http://vocabulary.odm2.org/variablename/ const char* calculatedOutShortRadName = "Radiation, outgoing shortwave"; // This must be a value from http://vocabulary.odm2.org/units/ const char* calculatedOutShortRadUnit = "W/m^2"; // A short code for the variable const char* calculatedOutShortRadCode = "OSWR"; // The (optional) universallly unique identifier const char* calculatedOutShortRadUUID = "12345678-abcd-1234-ef00-1234567890ab"; Variable* radiationOutgoingShortwave = new Variable( calculateOutShortRad, calculatedOutShortRadResolution, calculatedOutShortRadName, calculatedOutShortRadUnit, calculatedOutShortRadCode, calculatedOutShortRadUUID); // ========================================================================== // Constants for longwave calculations // ========================================================================== // Steinhart-Hart equation constants for thermistor with 30 kOhm resistance at 25 deg C // Found on page 14 of SL-510-610 manual const float A_less = 0.000932960; // Temperatures less than 0 deg C const float B_less = 0.000221424; // Temperatures less than 0 deg C const float C_less = 0.000000126329; // Temperatures less than 0 deg C const float A_more = 0.000932794; // Temperatures more than 0 deg C const float B_more = 0.000221451; // Temperatures more than 0 deg C const float C_more = 0.000000126233; // Temperatures more than 0 deg C // Stefan-Boltzmann constant const float sb_const = 0.000000056704; // Volt power supply to the pyrgeometer thermistor const float powerPyrg = 3300; // ========================================================================== // Apogee SL-510-SS for incoming longwave radiation // ========================================================================== const int8_t sl510Power = sensorPowerPin; const uint8_t sl510ThermADSChannel = 0; const uint8_t sl510PyrgADSChannel = 1; TIADS1x15 sl510Therm(sl510Power, sl510ThermADSChannel, adsGain, boardADSi2cAddress, apogeeNumReadings); TIADS1x15 sl510Pyrg(sl510Power, sl510PyrgADSChannel, adsGain, boardADSi2cAddress, apogeeNumReadings); Variable* sl510ThermVoltage = new TIADS1x15_Voltage(&sl510Therm, "12345678-abcd-1234-ef00-1234567890ab"); Variable* sl510PyrgVoltage = new TIADS1x15_Voltage(&sl510Pyrg, "12345678-abcd-1234-ef00-1234567890ab"); const float K1in = 9.509; // calibration coefficient (K1) from apogee certificate const float K2in = 1.020; // calibration coefficient (K2) from apogee certificate float RtIn; // Thermistor resistance using half-bridge measurement float pyrgInTemp; float calculateInLongRad(void) { float calculatedResult = -9999; // Always safest to start with a bad value float inputVar1 = sl510ThermVoltage->getValue(); float inputVar2 = sl510PyrgVoltage->getValue(); // make sure both inputs are good if (inputVar1 != -9999 && inputVar2 != -9999) { RtIn = 24900 * (inputVar1 * 1000 / (powerPyrg - inputVar1 * 1000)); if (RtIn > 94980) { pyrgInTemp = 1 / (A_less + B_less * log(RtIn) + C_less * pow(log(RtIn), 3)); // for temperatures below 0 degC } else { pyrgInTemp = 1 / (A_more + B_more * log(RtIn) + C_more * pow(log(RtIn), 3)); // for temperatures above 0 degC } calculatedResult = K1in * inputVar2 + K2in * sb_const * pow(pyrgInTemp, 4); // Equation retrieved from product manual } return calculatedResult; } // Properties of the calculated incoming longwave radiation // The number of digits after the decimal place const uint8_t calculatedInLongRadResolution = 2; // This must be a value from http://vocabulary.odm2.org/variablename/ const char* calculatedInLongRadName = "Radiation, incoming longwave"; // This must be a value from http://vocabulary.odm2.org/units/ const char* calculatedInLongRadUnit = "W/m^2"; // A short code for the variable const char* calculatedInLongRadCode = "ILWR"; // The (optional) universallly unique identifier const char* calculatedInLongRadUUID = "12345678-abcd-1234-ef00-1234567890ab"; Variable* radiationIncomingLongwave = new Variable( calculateInLongRad, calculatedInLongRadResolution, calculatedInLongRadName, calculatedInLongRadUnit, calculatedInLongRadCode, calculatedInLongRadUUID); // ========================================================================== // Apogee SL-610-SS for outgoing longwave radiation // ========================================================================== const int8_t sl610Power = sensorPowerPin; const uint8_t sl610ThermADSChannel = 0; const uint8_t sl610PyrgADSChannel = 1; TIADS1x15 sl610Therm(sl610Power, sl610ThermADSChannel, adsGain, extraADSi2cAddress, apogeeNumReadings); TIADS1x15 sl610Pyrg(sl610Power, sl610PyrgADSChannel, adsGain, extraADSi2cAddress, apogeeNumReadings); Variable* sl610ThermVoltage = new TIADS1x15_Voltage(&sl610Therm, "12345678-abcd-1234-ef00-1234567890ab"); Variable* sl610PyrgVoltage = new TIADS1x15_Voltage(&sl610Pyrg, "12345678-abcd-1234-ef00-1234567890ab"); const float K1out; // calibration coefficient (K1) from apogee certificate const float K2out; // calibration coefficient (K2) from apogee certificate float RtOut; // Thermistor resistance using half-bridge measurement float pyrgOutTemp; float calculateOutLongRad(void) { float calculatedResult = -9999; // Always safest to start with a bad value float inputVar1 = sl610ThermVoltage->getValue(); float inputVar2 = sl610PyrgVoltage->getValue(); // make sure both input is good if (inputVar1 != -9999 && inputVar2 != -9999) { RtOut = 24900 * (inputVar1 / (powerPyrg - inputVar1)); if (RtOut > 94980) { pyrgOutTemp = 1 / (A_less + B_less * log(RtOut) + C_less * pow(log(RtOut), 3)); // for temperatures below 0 degC } else { pyrgOutTemp = 1 / (A_more + B_more * log(RtOut) + C_more * pow(log(RtOut), 3)); // for temperatures above 0 degC } calculatedResult = K1out * inputVar2 + K2out * sb_const * pow(pyrgOutTemp, 4); // Equation retrieved from product manual } return calculatedResult; } // Properties of the calculated incoming longwave radiation // The number of digits after the decimal place const uint8_t calculatedOutLongRadResolution = 2; // This must be a value from http://vocabulary.odm2.org/variablename/ const char* calculatedOutLongRadName = "Radiation, outgoing longwave"; // This must be a value from http://vocabulary.odm2.org/units/ const char* calculatedOutLongRadUnit = "W/m^2"; // A short code for the variable const char* calculatedOutLongRadCode = "OLWR"; // The (optional) universallly unique identifier const char* calculatedOutLongRadUUID = "12345678-abcd-1234-ef00-1234567890ab"; Variable* radiationOutgoingLongwave = new Variable( calculateOutLongRad, calculatedOutLongRadResolution, calculatedOutLongRadName, calculatedOutLongRadUnit, calculatedOutLongRadCode, calculatedOutLongRadUUID); // ========================================================================== // METER Teros 12 Soil Moisture Sensors // ========================================================================== #include <sensors/MeterTeros11.h> char add1 = "a"; // Address 1 at depth XXXX char add2 = "b"; // Address 2 at depth XXXX char add3 = "c"; // Address 3 at depth XXXX int8_t sdiPowerPin = sensorPowerPin; int8_t sdiDataPin = 7; MeterTeros11 probe1(add1, sdiPowerPin, sdiDataPin); MeterTeros11 probe2(add2, sdiPowerPin, sdiDataPin); MeterTeros11 probe3(add3, sdiPowerPin, sdiDataPin); Variable* rawVWCCounts1 = new MeterTeros11_Count(&probe1, "12345678-abcd-1234-ef00-1234567890ab"); Variable* soilTemp1 = new MeterTeros11_Temp(&probe1, "12345678-abcd-1234-ef00-1234567890ab"); Variable* soilEa1 = new MeterTeros11_Ea(&probe1, "12345678-abcd-1234-ef00-1234567890ab"); Variable* vwc1 = new MeterTeros11_VWC(&probe1, "12345678-abcd-1234-ef00-1234567890ab"); Variable* rawVWCCounts2 = new MeterTeros11_Count(&probe2, "12345678-abcd-1234-ef00-1234567890ab"); Variable* soilTemp2 = new MeterTeros11_Temp(&probe2, "12345678-abcd-1234-ef00-1234567890ab"); Variable* soilEa2 = new MeterTeros11_Ea(&probe2, "12345678-abcd-1234-ef00-1234567890ab"); Variable* vwc2 = new MeterTeros11_VWC(&probe2, "12345678-abcd-1234-ef00-1234567890ab"); Variable* rawVWCCounts3 = new MeterTeros11_Count(&probe3, "12345678-abcd-1234-ef00-1234567890ab"); Variable* soilTemp3 = new MeterTeros11_Temp(&probe3, "12345678-abcd-1234-ef00-1234567890ab"); Variable* soilEa3 = new MeterTeros11_Ea(&probe3, "12345678-abcd-1234-ef00-1234567890ab"); Variable* vwc3 = new MeterTeros11_VWC(&probe3, "12345678-abcd-1234-ef00-1234567890ab"); // ========================================================================== // Creating the Variable Array[s] and Filling with Variable Objects // ========================================================================== /** Start [variable_arrays] */ Variable* variableList[] = { new ProcessorStats_SampleNumber(&mcuBoard), new ProcessorStats_FreeRam(&mcuBoard), new ProcessorStats_Battery(&mcuBoard), new MaximDS3231_Temp(&ds3231), sonarRange, calculatedSnowDepth, sp510Voltage, radiationIncomingShortwave, sp610Voltage, radiationOutgoingShortwave, sl510ThermVoltage, sl510PyrgVoltage, radiationIncomingLongwave, sl610ThermVoltage, sl610PyrgVoltage, radiationOutgoingLongwave, rawVWCCounts1, soilTemp1, soilEa1, vwc1, rawVWCCounts2, soilTemp2, soilEa2, vwc2, rawVWCCounts3, soilTemp3, soilEa3, vwc3 // Additional sensor variables can be added here, by copying the syntax // for creating the variable pointer (FORM1) from the // <code>menu_a_la_carte.ino</code> example // The example code snippets in the wiki are primarily FORM2. }; const char* UUIDs[] = { "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", "12345678-abcd-1234-ef00-1234567890ab", // ... The number of UUID's must match the number of variables! "12345678-abcd-1234-ef00-1234567890ab", }; // Count up the number of pointers in the array int variableCount = sizeof(variableList) / sizeof(variableList[0]); // Create the VariableArray object VariableArray varArray; /** End [variable_arrays] */ // ========================================================================== // The Logger Object[s] // ========================================================================== /** Start [loggers] */ // Create a logger instance Logger dataLogger; /** End [loggers] */ // ========================================================================== // Working Functions // ========================================================================== /** Start [working_functions] */ // Flashes the LED's on the primary board void greenredflash(uint8_t numFlash = 4, uint8_t rate = 75) { for (uint8_t i = 0; i < numFlash; i++) { digitalWrite(greenLED, HIGH); digitalWrite(redLED, LOW); delay(rate); digitalWrite(greenLED, LOW); digitalWrite(redLED, HIGH); delay(rate); } digitalWrite(redLED, LOW); } /** End [working_functions] */ // ========================================================================== // Arduino Setup Function // ========================================================================== /** Start [setup] */ void setup() { // Start the primary serial connection Serial.begin(serialBaud); // Print a start-up note to the first serial port Serial.print(F("Now running ")); Serial.print(sketchName); Serial.print(F(" on Logger ")); Serial.println(LoggerID); Serial.println(); Serial.print(F("Using ModularSensors Library version ")); Serial.println(MODULAR_SENSORS_VERSION); // Set up pins for the LED's pinMode(greenLED, OUTPUT); digitalWrite(greenLED, LOW); pinMode(redLED, OUTPUT); digitalWrite(redLED, LOW); // Blink the LEDs to show the board is on and starting up greenredflash(); // Set the timezones for the logger/data and the RTC // Logging in the given time zone Logger::setLoggerTimeZone(timeZone); // It is STRONGLY RECOMMENDED that you set the RTC to be in UTC (UTC+0) Logger::setRTCTimeZone(0); // Set information pins dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, greenLED); // Begin the variable array[s], logger[s], and publisher[s] varArray.begin(variableCount, variableList); dataLogger.begin(LoggerID, loggingInterval, &varArray); // Set up the sensors Serial.println(F("Setting up sensors...")); varArray.setupSensors(); // Create the log file, adding the default header to it // Do this last so we have the best chance of getting the time correct and // all sensor names correct dataLogger.createLogFile(true); // true = write a new header // Call the processor sleep dataLogger.systemSleep(); sonarSerial.begin(9600); } /** End [setup] */ // ========================================================================== // Arduino Loop Function // ========================================================================== /** Start [loop] */ void loop() { dataLogger.logData(); } /** End [loop] */ |