SparkFun Forums 

Where electronics enthusiasts find answers.

#205044
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]
#205058
Thank you. I am on 1.3.2, still no joy....

-Jeremy

/Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src/SparkFun_AS3935.cpp: In constructor 'SparkFun_AS3935::SparkFun_AS3935(int)':
/Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src/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; }
... /Users/jeremy/Documents/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library
exit status 1
Error compiling for board SparkFun SAMD51 Thing Plus.
You do not have the required permissions to view the files attached to this post.
#205059
Woops, I had forgotten to release the latest with the fix, sorry about that. I'm not sure how long it takes for the Arduino Library to refresh with the latest but keep a look out for v1.3.3 and let me know if that fixes the issue for you.
#205112
When I change...

#define AS3935_ADDR 0x03
SparkFun_AS3935 lightning(AS3935_ADDR);

In Example1_BasicLightning_I2C and Example2_More_Lightning_Features_I2C to....

SparkFun_AS3935 lightning(AS3935_DEFAULT_ADDRESS); //Defined in SparkFun_AS3935.h

I have success compiling for SAMD21/51.

-Jeremy