Ok, I’m looking at the Arduino website now.
So it looks like the MKR is a SAMD21 based board, not an AVR based board like the UNO. So, then, yes, just including AltSoftSerial will cause the code to fail to compile because AltSoftSerial is AVR only.
Based on the schematics, the MKR RS485 shield connects the Tx and Rx of the RS485 to
Serial1 of the MKR1000 (and I assume whatever clone of that you have). So that means you should delete everything related to SoftwareSerial, AltSoftSerial, or ESP8266. In it’s place, you just need to add one line
HardwareSerial& modbusSerial = Serial1; Then you should be able to use
modbusSerial just like in the examples.
Apart from the code, you do need to make sure you’re supplying the Y4000 with enough power. I’ve never actually touched a Y4000, but if I remember correctly it needs 12V and reasonable amperage. That ISOVcc pin on the shield is *not* supplying power to the sensors. The ISOVcc pin is part of the fail-safe for the chip that keeps the RS485 pins logic-high if something gets disconnected. It should be connected to the Vcc of whatever you’re powering the sonde with (in addition to the Sonde power wire connection). The same is true of the ISOGnd – it gets connected to the ground of the sonde power supply *and* the sonde’s ground wire, not only one or the other. Connecting the ISOVcc on the shield is optional (though I think the fail-safe won’t work without it). The ISOGnd should be connected.
I think you also want to set your dip switches to “half duplex” and terminate the Y-Z since the Yosemitech is half-duplex A/B only.