I am using the DFRobot equivalent of the Arduino Uno board, the DFRdunio UNO R3, stacked with a DF Robot Gravity expansion shield and Adafruit datalogging shield w./ SD card. The links for all 3 things can be found at the bottom of this post.
It will have many sensors connected to analog ports A0-A3 and one digitial port in use as well. Right now I am trying to get the SD card to log data for date/time and just one of the sensors, the total dissolved solids (TDS) sensor. I am using code from a friend who did this with the same board/ SD shield set up and a CO2 sensor and am trying to edit it to fit my sensor needs. But I cant get the code to verify. I get this error (sorry it's so long I'm trying to follow the rules about including whole error message)
Arduino: 1.8.13 (Windows 10), Board: "Arduino MKR WiFi 1010"
C:\Users\katie\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Users\katie\Arduino\hardware -hardware C:\Users\katie\AppData\Local\Arduino15\packages -tools C:\Users\katie\Arduino\tools-builder -tools C:\Users\katie\Arduino\hardware\tools\avr -tools C:\Users\katie\AppData\Local\Arduino15\packages -built-in-libraries C:\Users\katie\Arduino\libraries -libraries C:\Users\katie\OneDrive\Documents\Arduino\libraries -fqbn=arduino:samd:mkrwifi1010 -ide-version=10813 -build-path C:\Users\katie\AppData\Local\Temp\arduino_build_719152 -warnings=none -build-cache C:\Users\katie\AppData\Local\Temp\arduino_cache_125191 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.CMSIS.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-4.5.0.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.openocd.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7 -prefs=runtime.tools.openocd-0.10.0-arduino7.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7 -prefs=runtime.tools.bossac.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3 -prefs=runtime.tools.bossac-1.7.0-arduino3.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3 -prefs=runtime.tools.arduinoOTA.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -prefs=runtime.tools.CMSIS-Atmel.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.CMSIS-Atmel-1.2.0.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0 -verbose C:\Users\katie\OneDrive\Documents\Arduino\River sensor package\Board 1- Water Qual\TDS_DO_Turb_Temp_copy\TDS_DO_Turb_Temp_SDcopy\TDS_DO_Turb_Temp_SDcopy.ino
C:\Users\katie\Arduino\arduino-builder -compile -logger=machine -hardware C:\Users\katie\Arduino\hardware -hardware C:\Users\katie\AppData\Local\Arduino15\packages -tools C:\Users\katie\Arduino\tools-builder -tools C:\Users\katie\Arduino\hardware\tools\avr -tools C:\Users\katie\AppData\Local\Arduino15\packages -built-in-libraries C:\Users\katie\Arduino\libraries -libraries C:\Users\katie\OneDrive\Documents\Arduino\libraries -fqbn=arduino:samd:mkrwifi1010 -ide-version=10813 -build-path C:\Users\katie\AppData\Local\Temp\arduino_build_719152 -warnings=none -build-cache C:\Users\katie\AppData\Local\Temp\arduino_cache_125191 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.CMSIS.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-4.5.0.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.openocd.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7 -prefs=runtime.tools.openocd-0.10.0-arduino7.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7 -prefs=runtime.tools.bossac.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3 -prefs=runtime.tools.bossac-1.7.0-arduino3.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3 -prefs=runtime.tools.arduinoOTA.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -prefs=runtime.tools.CMSIS-Atmel.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.CMSIS-Atmel-1.2.0.path=C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0 -verbose C:\Users\katie\OneDrive\Documents\Arduino\River sensor package\Board 1- Water Qual\TDS_DO_Turb_Temp_copy\TDS_DO_Turb_Temp_SDcopy\TDS_DO_Turb_Temp_SDcopy.ino
Using board 'mkrwifi1010' from platform in folder: C:\Users\katie\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11
Using core 'arduino' from platform in folder: C:\Users\katie\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11
Detecting libraries used...
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\sketch\\TDS_DO_Turb_Temp_SDcopy.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for SD.h: [SD@1.2.4]
ResolveLibrary(SD.h)
-> candidates: [SD@1.2.4]
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\sketch\\TDS_DO_Turb_Temp_SDcopy.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
-> candidates: [Wire@1.0]
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\sketch\\TDS_DO_Turb_Temp_SDcopy.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for RTClib.h: [RTClib@1.14.0]
ResolveLibrary(RTClib.h)
-> candidates: [RTClib@1.14.0]
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\RTClib\\src" "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\sketch\\TDS_DO_Turb_Temp_SDcopy.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for OneWire.h: [OneWire@2.3.5]
ResolveLibrary(OneWire.h)
-> candidates: [OneWire@2.3.5]
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\RTClib\\src" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\OneWire" "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\sketch\\TDS_DO_Turb_Temp_SDcopy.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\RTClib\\src" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\OneWire" "C:\\Users\\katie\\Arduino\\libraries\\SD\\src\\File.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\RTClib\\src" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\OneWire" "C:\\Users\\katie\\Arduino\\libraries\\SD\\src\\SD.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\RTClib\\src" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\OneWire" "C:\\Users\\katie\\Arduino\\libraries\\SD\\src\\utility\\Sd2Card.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for SPI.h: [SPI@1.0]
ResolveLibrary(SPI.h)
-> candidates: [SPI@1.0]
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\RTClib\\src" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\OneWire" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\SPI" "C:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\OneWire\\OneWire.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\RTClib\\src" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\OneWire" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\SPI" "C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\SPI\\SPI.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Generating function prototypes...
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\RTClib\\src" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\OneWire" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\SPI" "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\sketch\\TDS_DO_Turb_Temp_SDcopy.ino.cpp" -o "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Users\\katie\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10813 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\cores\\arduino" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\variants\\mkrwifi1010" "-IC:\\Users\\katie\\Arduino\\libraries\\SD\\src" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\Wire" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\RTClib\\src" "-IC:\\Users\\katie\\OneDrive\\Documents\\Arduino\\libraries\\OneWire" "-IC:\\Users\\katie\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11\\libraries\\SPI" "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\sketch\\TDS_DO_Turb_Temp_SDcopy.ino.cpp" -o "C:\\Users\\katie\\AppData\\Local\\Temp\\arduino_build_719152\\sketch\\TDS_DO_Turb_Temp_SDcopy.ino.cpp.o"
In file included from C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
from C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/samd.h:105,
from C:\Users\katie\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11\cores\arduino/Arduino.h:35,
from C:\Users\katie\Arduino\libraries\SD\src/SD.h:18,
from C:\Users\katie\OneDrive\Documents\Arduino\River sensor package\Board 1- Water Qual\TDS_DO_Turb_Temp_copy\TDS_DO_Turb_Temp_SDcopy\TDS_DO_Turb_Temp_SDcopy.ino:3:
C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:487:38: error: expected ')' before '*' token
#define RTC ((Rtc *)0x40001400UL) /**< \brief (RTC) APB Base Address */
^
C:\Users\katie\OneDrive\Documents\Arduino\River sensor package\Board 1- Water Qual\TDS_DO_Turb_Temp_copy\TDS_DO_Turb_Temp_SDcopy\TDS_DO_Turb_Temp_SDcopy.ino:8:13: note: in expansion of macro 'RTC'
RTC_PCF8523 RTC; // define the Real Time Clock object
^~~
C:\Users\katie\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:487:38: error: expected ')' before '*' token
#define RTC ((Rtc *)0x40001400UL) /**< \brief (RTC) APB Base Address */
^
C:\Users\katie\OneDrive\Documents\Arduino\River sensor package\Board 1- Water Qual\TDS_DO_Turb_Temp_copy\TDS_DO_Turb_Temp_SDcopy\TDS_DO_Turb_Temp_SDcopy.ino:8:13: note: in expansion of macro 'RTC'
RTC_PCF8523 RTC; // define the Real Time Clock object
^~~
C:\Users\katie\OneDrive\Documents\Arduino\River sensor package\Board 1- Water Qual\TDS_DO_Turb_Temp_copy\TDS_DO_Turb_Temp_SDcopy\TDS_DO_Turb_Temp_SDcopy.ino: In function 'void setup()':
TDS_DO_Turb_Temp_SDcopy:88:7: error: request for member 'begin' in '(Rtc*)1073746944', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
RTC.begin(); //given error message about rtc being ointer type
^~~~~
TDS_DO_Turb_Temp_SDcopy:89:7: error: request for member 'adjust' in '(Rtc*)1073746944', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
RTC.adjust(DateTime(__DATE__, __TIME__)); //Set up the date/time to match computer
^~~~~~
TDS_DO_Turb_Temp_SDcopy:117:12: error: request for member 'begin' in '(Rtc*)1073746944', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
if (!RTC.begin()) {
^~~~~
C:\Users\katie\OneDrive\Documents\Arduino\River sensor package\Board 1- Water Qual\TDS_DO_Turb_Temp_copy\TDS_DO_Turb_Temp_SDcopy\TDS_DO_Turb_Temp_SDcopy.ino: In function 'void loop()':
TDS_DO_Turb_Temp_SDcopy:136:22: error: request for member 'now' in '(Rtc*)1073746944', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
DateTime now = RTC.now();
^~~
Using library SD at version 1.2.4 in folder: C:\Users\katie\Arduino\libraries\SD
Using library Wire at version 1.0 in folder: C:\Users\katie\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11\libraries\Wire
Using library RTClib at version 1.14.0 in folder: C:\Users\katie\OneDrive\Documents\Arduino\libraries\RTClib
Using library OneWire at version 2.3.5 in folder: C:\Users\katie\OneDrive\Documents\Arduino\libraries\OneWire
Using library SPI at version 1.0 in folder: C:\Users\katie\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11\libraries\SPI
exit status 1
**request for member 'begin' in '(Rtc*)1073746944', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?**
I am in grad school and VERY novice at this and while I've looked into pointer type operators on this froum and the Arduino site after recevinig this error message, I do not understand how to change my code from here. My code is as follows:
//Board 1 with TDS on A0, DO on A1, Turbidity on A2 (A4 and A5 being used by RTC?)- Adding code on 8/31 for SD storage
/*** SD Code***/
#include "SD.h"
#include <Wire.h>
#include "RTClib.h"
#define LOG_INTERVAL 1000 // mills between entries
#define ECHO_TO_SERIAL 1 // echo data to serial port
RTC_PCF8523 RTC; // define the Real Time Clock object
// for the data logging shield, we use digital pin 10 for the SD cs line
const int chipSelect = 10;
// the logging file
File logfile;
void error(char *str)
{ Serial.print("error: ");
Serial.println(str);
}
/*** TDS Code***/
#define TdsSensorPin A0
const int VREF = 5.0; // analog reference voltage(Volt) of the ADC
const int SCOUNT = 30; // sum of sample point
int analogBuffer[SCOUNT]; // store the analog value in the array, read from ADC
int analogBufferTemp[SCOUNT];
int analogBufferIndex = 0, copyIndex = 0;
float averageVoltage = 0, tdsValue = 0, temperature = 25;
/*** DO Sensor Code***/
#include <Arduino.h>
#define DO_PIN A1
#define VREF 5000 //VREF (mv)
#define ADC_RES 1024 //ADC Resolution
//Single-point calibration Mode=0
//Two-point calibration Mode=1
#define TWO_POINT_CALIBRATION 0
#define READ_TEMP (25) //Current water temperature ℃, Or temperature sensor function
//Single point calibration needs to be filled CAL1_V and CAL1_T
#define CAL1_V (1600) //mv
#define CAL1_T (25) //℃
//Two-point calibration needs to be filled CAL2_V and CAL2_T
//CAL1 High temperature point, CAL2 Low temperature point
#define CAL2_V (1300) //mv
#define CAL2_T (15) //℃
const uint16_t DO_Table[41] = {
14460, 14220, 13820, 13440, 13090, 12740, 12420, 12110, 11810, 11530,
11260, 11010, 10770, 10530, 10300, 10080, 9860, 9660, 9460, 9270,
9080, 8900, 8730, 8570, 8410, 8250, 8110, 7960, 7820, 7690,
7560, 7430, 7300, 7180, 7070, 6950, 6840, 6730, 6630, 6530, 6410
};
uint8_t Temperaturet;
uint16_t ADC_Raw;
uint16_t ADC_Voltage;
uint16_t DO;
int16_t readDO(uint32_t voltage_mv, uint8_t temperature_c)
{
#if TWO_POINT_CALIBRATION == 0
uint16_t V_saturation = (uint32_t)CAL1_V + (uint32_t)35 * temperature_c - (uint32_t)CAL1_T * 35;
return (voltage_mv * DO_Table[temperature_c] / V_saturation);
#else
uint16_t V_saturation = (int16_t)((int8_t)temperature_c - CAL2_T) * ((uint16_t)CAL1_V - CAL2_V) / ((uint8_t)CAL1_T - CAL2_T) + CAL2_V;
return (voltage_mv * DO_Table[temperature_c] / V_saturation);
#endif
}
/*** Temp Probe Code***/
#include <OneWire.h>
int DS18S20_Pin = 8; //DS18S20 Signal pin on digital 8
//Temperature chip i/o
OneWire ds(DS18S20_Pin); // on digital pin 8
void setup()
{
Serial.begin(115200); //Same BAUD rate for all sensors
//SD Code//
Serial.println("Serial Up!");
// initialize the SD card
Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to
// output, even if you don't use it:
pinMode(10, OUTPUT);
RTC.begin(); //given error message about rtc being ointer type
RTC.adjust(DateTime(__DATE__, __TIME__)); //Set up the date/time to match computer
// RTC.setTime();//write time to chip
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
// create a new file
char filename[] = "LOGGER00.CSV";
for (uint8_t i = 0; i < 100; i++) {
filename[6] = i / 10 + '0';
filename[7] = i % 10 + '0';
if (! SD.exists(filename)) {
// only open a new file if it doesn't exist
logfile = SD.open(filename, FILE_WRITE);
break; // leave the loop!
logfile.close();
}
}
Serial.print("Logging to: ");
Serial.println(filename);
Wire.begin();
if (!RTC.begin()) {
logfile.println("RTC failed");
#if ECHO_TO_SERIAL
Serial.println("RTC failed");
#endif //ECHO_TO_SERIAL
logfile.println("millis,time,light,temp");
#if ECHO_TO_SERIAL
Serial.println("millis,time,light,temp");
#endif ECHO_TO_SERIAL// attempt to write out the header to the file
// if (logfile.write_error || !logfile.sync()) {
// error("write header");
}
//TDS Code
pinMode(TdsSensorPin, INPUT);// No DO or turbidity in Set up
}
void loop()
{
//SD code//
DateTime now = RTC.now();
// delay for the amount of time we want between readings
delay((LOG_INTERVAL - 1) - (millis() % LOG_INTERVAL));
// log milliseconds since starting
uint32_t m = millis();
logfile.print(m); // milliseconds since start
logfile.print(", ");
#if ECHO_TO_SERIAL
Serial.print(m); // milliseconds since start
Serial.print(", ");
#endif
// if (! SD.exists(filename)) {
// only open a new file if it doesn't exist
logfile = SD.open("TESTFILE.CSV", FILE_WRITE);
// break; // leave the loop! Unable to open and write to file
// }
logfile.write("STARTING THE LOG FILE");
// fetch the time
// now = DateTime RTC.now();
// log time
// logfile.print(now); // seconds since 2000
logfile.print(", ");
logfile.print(now.year(), DEC);
logfile.print("/");
logfile.print(now.month(), DEC);
logfile.print("/");
logfile.print(now.day(), DEC);
logfile.print(" ");
logfile.print(now.hour(), DEC);
logfile.print(":");
logfile.print(now.minute(), DEC);
logfile.print(":");
logfile.print(now.second(), DEC);
#if ECHO_TO_SERIAL
// Serial.print(now()); // seconds since 2000
Serial.print(", ");
Serial.print(now.year(), DEC);
Serial.print("/");
Serial.print(now.month(), DEC);
Serial.print("/");
Serial.print(now.day(), DEC);
Serial.print(" ");
Serial.print(now.hour(), DEC);
Serial.print(":");
Serial.print(now.minute(), DEC);
Serial.print(":");
Serial.print(now.second(), DEC);
#endif //ECHO_TO_SERIAL
// TDS Code
static unsigned long analogSampleTimepoint = millis();
if (millis() - analogSampleTimepoint > 40U) //every 40 milliseconds,read the analog value from the ADC
{
analogSampleTimepoint = millis();
analogBuffer[analogBufferIndex] = analogRead(TdsSensorPin); //read the analog value and store into the buffer
analogBufferIndex++;
if (analogBufferIndex == SCOUNT)
analogBufferIndex = 0;
}
static unsigned long printTimepoint = millis();
if (millis() - printTimepoint > 800U)
{
printTimepoint = millis();
for (copyIndex = 0; copyIndex < SCOUNT; copyIndex++)
analogBufferTemp[copyIndex] = analogBuffer[copyIndex];
averageVoltage = getMedianNum(analogBufferTemp, SCOUNT) * (float)VREF / 1024.0; // read the analog value more stable by the median filtering algorithm, and convert to voltage value
float compensationCoefficient = 1.0 + 0.02 * (temperature - 25.0); //temperature compensation formula: fFinalResult(25^C) = fFinalResult(current)/(1.0+0.02*(fTP-25.0));
float compensationVolatge = averageVoltage / compensationCoefficient; //temperature compensation
tdsValue = (133.42 * compensationVolatge * compensationVolatge * compensationVolatge - 255.86 * compensationVolatge * compensationVolatge + 857.39 * compensationVolatge) * 0.5; //convert voltage value to tds value
//Serial.print("voltage:");
//Serial.print(averageVoltage,2);
//Serial.print("V ");
Serial.print("TDS Value:");
Serial.print(tdsValue, 0);
Serial.println("ppm");
}
// DO Code
Temperaturet = (uint8_t)READ_TEMP;
ADC_Raw = analogRead(DO_PIN);
ADC_Voltage = uint32_t(VREF) * ADC_Raw / ADC_RES;
Serial.print("Temperaturet:\t" + String(Temperaturet) + "\t");
Serial.print("ADC RAW:\t" + String(ADC_Raw) + "\t");
Serial.print("ADC Voltage:\t" + String(ADC_Voltage) + "\t");
Serial.println("DO:\t" + String(readDO(ADC_Voltage, Temperaturet)) + "\t");
// Turbidity Code
int sensorValue = analogRead(A2);//
float voltage = sensorValue * (5.0 / 1024.0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
//Serial.println(voltage); // print out the value you read:
Serial.println("Turbidity:" + String(voltage) );
//Temp Probe Code
float temperature = getTemp();
Serial.print("Water Temperature:");
Serial.println(temperature);
Serial.print("\n");
delay(1000);
}
int getMedianNum(int bArray[], int iFilterLen)
{
int bTab[iFilterLen];
for (byte i = 0; i < iFilterLen; i++)
bTab[i] = bArray[i];
int i, j, bTemp;
for (j = 0; j < iFilterLen - 1; j++)
{
for (i = 0; i < iFilterLen - j - 1; i++)
{
if (bTab[i] > bTab[i + 1])
{
bTemp = bTab[i];
bTab[i] = bTab[i + 1];
bTab[i + 1] = bTemp;
}
}
}
if ((iFilterLen & 1) > 0)
bTemp = bTab[(iFilterLen - 1) / 2];
else
bTemp = (bTab[iFilterLen / 2] + bTab[iFilterLen / 2 - 1]) / 2;
return bTemp;
}
// Temp Probe Code
float getTemp() {
//returns the temperature from one DS18S20 in DEG Celsius
byte data[12];
byte addr[8];
if ( !ds.search(addr)) {
//no more sensors on chain, reset search
ds.reset_search();
return -1000;
}
if ( OneWire::crc8( addr, 7) != addr[7]) {
Serial.println("CRC is not valid!");
return -1000;
}
if ( addr[0] != 0x10 && addr[0] != 0x28) {
Serial.print("Device is not recognized");
return -1000;
}
ds.reset();
ds.select(addr);
ds.write(0x44, 1); // start conversion, with parasite power on at the end
byte present = ds.reset();
ds.select(addr);
ds.write(0xBE); // Read Scratchpad
for (int i = 0; i < 9; i++) { // we need 9 bytes
data[i] = ds.read();
}
ds.reset_search();
byte MSB = data[1];
byte LSB = data[0];
float tempRead = ((MSB << 8) | LSB); //using two's compliment
float TemperatureSum = tempRead / 16;
return TemperatureSum;
delay(1500); //wait 1.5 seconds
logfile.print(", ");
logfile.println(tdsValue);
#if ECHO_TO_SERIAL
Serial.print(", ");
Serial.println(tdsValue);
#endif //ECHO_TO_SERIAL
////////////////
Serial.print("Closing logfile");
logfile.close();
}
Board- DFRduino UNO R3 - Compatible with Arduino Uno - DFRobot
Expansion shield- Gravity: IO Expansion Shield for Arduino V7.1 - DFRobot
SD shield- Adafruit Assembled Data Logging shield for Arduino : ID 1141 : $13.95 : Adafruit Industries, Unique & fun DIY electronics and kits