Communication between two MKR IoT Carrier's

Hi,

I wish to connect two MKR IoT Carrier to the same MKR1010 Wifi board in order to get additional relays for my project. Is this possible, and if so, how do I connect them to be able to control the four relays?

As I can understand I can connect two Oplà carrier boards using an I2C cable.

I tried using this code:

#include <Arduino_MKRIoTCarrier.h>//Include Carrier Shield for 2 relais

MKRIoTCarrier carrier; //Name of shield for the code

// Create instances of the Carrier class for each board

MKRIoTCarrier carrier1(0x08); // create object for first carrier board

MKRIoTCarrier carrier2(0x09); // create object for second carrier board

But I get this error:

Compilation error: no matching function for call to 'MKRIoTCarrier::MKRIoTCarrier(int)'

Welcome to the forum Sophie,

First Thank You for posting a well formed question that uses code tags.
But it would be better if you could post your entire code and the entire error.

The constructor for this library does not accept arguments. These two lines are the cause of your error.

MKRIoTCarrier carrier1(0x08); // create object for first carrier board

MKRIoTCarrier carrier2(0x09); // create object for second carrier board

Remove the arguments and the extra object(which was the only one that was correct):

#include <Arduino_MKRIoTCarrier.h>//Include Carrier Shield for 2 relais

// Create instances of the Carrier class for each board

MKRIoTCarrier carrier1; // create object for first carrier board

MKRIoTCarrier carrier2; // create object for second carrier board

It seems a waste to use a second Carrier for just a couple relays when a relay module is much cheaper.

This should get rid of that particular error.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.