Communication Modbus Arduino MKRwifi 1010 with library esp32ModbusRTU-master

Hello,

I’m trying to built a modbus communication between a sensor and a PLC wit redy using an Arduino mkrwifi 1010

I tried with library esp32ModbusRTU-master but I got this warning:

WARNING: library esp32ModbusRTU-master claims to run on esp32 architecture(s) and may be incompatible with your current board which runs on samd architecture(s).

I got the error on the code:

esp32ModbusRTU modbus(&Serial1, 4);

and

modbus.onData([](uint8_t serverAddress, esp32Modbus::FunctionCode fc, uint16_t address, uint8_t* data, size_t length) {
Serial.printf("id 0x%02x fc 0x%02x len %u: 0x", serverAddress, fc, length);

Serial.print("Data: 0x");

for (size_t i = 0; i < length; ++i) {
Serial.printf("%02x", data[i]);
if(i<length-1){
Serial.print(" 0x");
}

}
Serial.print("\n");

std::reverse(data, data + 4);  // fix endianness

Serial.print("Data: 0x");
for (size_t i = 0; i < length; ++i) {
Serial.printf("%02x", data[i]);
valLong = (valLong << 8) | data[i];
if(i<length-1){
Serial.print(" 0x");
}
}
Serial.print("\n");
Serial.println(valLong);

});

Witch library should I use for communication modbus on Arduino MKRWifi 1010?

Thanks in advance