I am having success with the AS3935 Lightning Detector Arduino examples for ATmega328.
But, when I try to compile for an SAMD21/51 I get the following error for the i2c address assignment…
SparkFun_AS3935.cpp:18:58: error: invalid conversion from ‘int’ to ‘i2cAddress {aka SF_AS3935_I2C_ADDRESS}’ [-fpermissive]
SparkFun_AS3935::SparkFun_AS3935(int address) { _address = address; }
Thoughts?
-Jeremy
Full compile debugging…
Arduino: 1.8.9 (Mac OS X), Board: “SparkFun SAMD21 Pro RF”
/Applications/Arduino189.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino189.app/Contents/Java/hardware -hardware /Users/jeremy/Library/Arduino15/packages -hardware /Users/jeremy/Documents/Arduino/hardware -tools /Applications/Arduino189.app/Contents/Java/tools-builder -tools /Applications/Arduino189.app/Contents/Java/hardware/tools/avr -tools /Users/jeremy/Library/Arduino15/packages -built-in-libraries /Applications/Arduino189.app/Contents/Java/libraries -libraries /Users/jeremy/Documents/Arduino/libraries -fqbn=SparkFun:samd:samd21_proRF -vid-pid=0X1B4F_0X214F -ide-version=10809 -build-path /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694 -warnings=none -build-cache /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_cache_245648 -prefs=build.warn_data_percentage=75 -verbose /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_modified_sketch_731335/Example2_More_Lightning_Features.ino
/Applications/Arduino189.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino189.app/Contents/Java/hardware -hardware /Users/jeremy/Library/Arduino15/packages -hardware /Users/jeremy/Documents/Arduino/hardware -tools /Applications/Arduino189.app/Contents/Java/tools-builder -tools /Applications/Arduino189.app/Contents/Java/hardware/tools/avr -tools /Users/jeremy/Library/Arduino15/packages -built-in-libraries /Applications/Arduino189.app/Contents/Java/libraries -libraries /Users/jeremy/Documents/Arduino/libraries -fqbn=SparkFun:samd:samd21_proRF -vid-pid=0X1B4F_0X214F -ide-version=10809 -build-path /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694 -warnings=none -build-cache /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_cache_245648 -prefs=build.warn_data_percentage=75 -verbose /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_modified_sketch_731335/Example2_More_Lightning_Features.ino
Using board ‘samd21_proRF’ from platform in folder: /Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1
Using core ‘arduino’ from platform in folder: /Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1
Detecting libraries used…
/Users/jeremy/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/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=10809 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x1B4F -DUSB_PID=0x214F -DUSBCON “-DUSB_MANUFACTURER="SparkFun"” “-DUSB_PRODUCT="SFE SAMD21 Pro RF"” -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/cores/arduino -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/variants/SparkFun_ProRF /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694/sketch/Example2_More_Lightning_Features.ino.cpp -o /dev/null
/Users/jeremy/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/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=10809 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x1B4F -DUSB_PID=0x214F -DUSBCON “-DUSB_MANUFACTURER="SparkFun"” “-DUSB_PRODUCT="SFE SAMD21 Pro RF"” -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/cores/arduino -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/variants/SparkFun_ProRF -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694/sketch/Example2_More_Lightning_Features.ino.cpp -o /dev/null
/Users/jeremy/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/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=10809 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x1B4F -DUSB_PID=0x214F -DUSBCON “-DUSB_MANUFACTURER="SparkFun"” “-DUSB_PRODUCT="SFE SAMD21 Pro RF"” -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/cores/arduino -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/variants/SparkFun_ProRF -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/Wire /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694/sketch/Example2_More_Lightning_Features.ino.cpp -o /dev/null
/Users/jeremy/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/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=10809 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x1B4F -DUSB_PID=0x214F -DUSBCON “-DUSB_MANUFACTURER="SparkFun"” “-DUSB_PRODUCT="SFE SAMD21 Pro RF"” -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/cores/arduino -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/variants/SparkFun_ProRF -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/Wire -I/Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694/sketch/Example2_More_Lightning_Features.ino.cpp -o /dev/null
/Users/jeremy/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/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=10809 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x1B4F -DUSB_PID=0x214F -DUSBCON “-DUSB_MANUFACTURER="SparkFun"” “-DUSB_PRODUCT="SFE SAMD21 Pro RF"” -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/cores/arduino -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/variants/SparkFun_ProRF -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/Wire -I/Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src /Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI/SPI.cpp -o /dev/null
/Users/jeremy/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/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=10809 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x1B4F -DUSB_PID=0x214F -DUSBCON “-DUSB_MANUFACTURER="SparkFun"” “-DUSB_PRODUCT="SFE SAMD21 Pro RF"” -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/cores/arduino -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/variants/SparkFun_ProRF -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/Wire -I/Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src /Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/Wire/Wire.cpp -o /dev/null
/Users/jeremy/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/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=10809 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x1B4F -DUSB_PID=0x214F -DUSBCON “-DUSB_MANUFACTURER="SparkFun"” “-DUSB_PRODUCT="SFE SAMD21 Pro RF"” -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/cores/arduino -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/variants/SparkFun_ProRF -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/Wire -I/Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src /Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src/SparkFun_AS3935.cpp -o /dev/null
Generating function prototypes…
/Users/jeremy/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/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=10809 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x1B4F -DUSB_PID=0x214F -DUSBCON “-DUSB_MANUFACTURER="SparkFun"” “-DUSB_PRODUCT="SFE SAMD21 Pro RF"” -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/cores/arduino -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/variants/SparkFun_ProRF -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/Wire -I/Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694/sketch/Example2_More_Lightning_Features.ino.cpp -o /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694/preproc/ctags_target_for_gcc_minus_e.cpp
/Applications/Arduino189.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c+±kinds=svpf --fields=KSTtzns --line-directives /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch…
/Users/jeremy/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/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=10809 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x1B4F -DUSB_PID=0x214F -DUSBCON “-DUSB_MANUFACTURER="SparkFun"” “-DUSB_PRODUCT="SFE SAMD21 Pro RF"” -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/Users/jeremy/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/cores/arduino -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/variants/SparkFun_ProRF -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI -I/Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/Wire -I/Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694/sketch/Example2_More_Lightning_Features.ino.cpp -o /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_build_279694/sketch/Example2_More_Lightning_Features.ino.cpp.o
Example2_More_Lightning_Features:35:38: error: invalid conversion from ‘int’ to ‘i2cAddress {aka SF_AS3935_I2C_ADDRESS}’ [-fpermissive]
SparkFun_AS3935 lightning(AS3935_ADDR);
^
In file included from /var/folders/gn/8f5_65qx4kzgf80w5_kc2bqc0000gn/T/arduino_modified_sketch_731335/Example2_More_Lightning_Features.ino:19:0:
/Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src/SparkFun_AS3935.h:71:5: error: initializing argument 1 of ‘SparkFun_AS3935::SparkFun_AS3935(i2cAddress)’ [-fpermissive]
SparkFun_AS3935(i2cAddress address);
^
Using library SPI at version 1.0 in folder: /Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/SPI
Using library Wire at version 1.0 in folder: /Users/jeremy/Library/Arduino15/packages/SparkFun/hardware/samd/1.6.1/libraries/Wire
Using library SparkFun_AS3935_Lightning_Detector_Arduino_Library at version 1.2.3 in folder: /Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library
exit status 1
invalid conversion from ‘int’ to ‘i2cAddress {aka SF_AS3935_I2C_ADDRESS}’ [-fpermissive]