Grove - 4-Channel SPDT Relay with XIAO SAMD21

Hi, I am trying to use “Grove - 4-Channel SPDT Relay” with “XIAO SAMD21”. I used the relay successfully with other SAMD boards like Arduino MKR, but for “XIAO SAMD21” I get the following validation error:

In file included from C:\Users\chris\Documents\Arduino\libraries\Multi_Channel_Relay_Arduino_Library-master\multi_channel_relay.cpp:25:0:

C:\Users\chris\Documents\Arduino\libraries\Multi_Channel_Relay_Arduino_Library-master\multi_channel_relay.cpp: In member function 'uint8_t Multi_Channel_Relay::scanI2CDevice()':

C:\Users\chris\Documents\Arduino\libraries\Multi_Channel_Relay_Arduino_Library-master/multi_channel_relay.h:36:25: error: 'SerialUSB' was not declared in this scope

     #define DEBUG_PRINT SerialUSB

                         ^

C:\Users\chris\Documents\Arduino\libraries\Multi_Channel_Relay_Arduino_Library-master\multi_channel_relay.cpp:92:5: note: in expansion of macro 'DEBUG_PRINT'

     DEBUG_PRINT.println("Scanning...");

     ^~~~~~~~~~~

C:\Users\chris\Documents\Arduino\libraries\Multi_Channel_Relay_Arduino_Library-master/multi_channel_relay.h:36:25: note: suggested alternative: 'Serial'

     #define DEBUG_PRINT SerialUSB

                         ^

C:\Users\chris\Documents\Arduino\libraries\Multi_Channel_Relay_Arduino_Library-master\multi_channel_relay.cpp:92:5: note: in expansion of macro 'DEBUG_PRINT'

     DEBUG_PRINT.println("Scanning...");

     ^~~~~~~~~~~

exit status 1

Compilation Error for Board Seeeduino XIAO.

Please advise, as everthing is from seeedstudio I was hoping that it would work together without a problem.

the problem is the code is not set up for that xiao SerialUSB is not a thing it uses a different method

I DONT like that DEBUG_PRINT… thats some Adafruit CRAP… i
google it to understand how it works

otherwise just replace it with Serial and should work fine

Hi there,
I believe what the OP was aiming for is this: :stuck_out_tongue_winking_eye:
If debug_print is defined then a new series of “functions” are created which are used for debugging just like Serial. print() but when you are done you just undefine debug_print (by commenting it out) and all the associated statements just vanish as the pre-processor does its substitution.
It’s a normal debugging technique used when an in line debugger is not available. Can be quit handy if it’s implemented correctly. He’s missing the part that assigns it to the serial print function is all. It is a good recommends to “google” the adafruit method as they use it heavily with a large beginner base.
my .02
HTH
GL :slight_smile: PJ :v: