<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[M5 RS485 Modbus slave sample code does not compile]]></title><description><![CDATA[<p dir="auto">I have an <a href="https://docs.m5stack.com/en/atom/atomhub_switch" target="_blank" rel="noopener noreferrer nofollow ugc">Atom Switch</a> that I want to use RS485 modbus with has not modbus sample code.  So I trying to use sample code from the <a href="https://docs.m5stack.com/en/atom/atom_dtu_nb" target="_blank" rel="noopener noreferrer nofollow ugc">ATOM DTU</a> devices.</p>
<p dir="auto">When I try to compile the <a href="https://github.com/m5stack/ATOM_DTU_NB/blob/master/examples/Modbus/ModBus-RTU/Slave/Slave.ino" target="_blank" rel="noopener noreferrer nofollow ugc">sample code</a> it gives the following error</p>
<pre><code>error: no matching function for call to 'RS485Class::RS485Class(HardwareSerial&amp;, int, int, int, int)'
 RS485Class RS485(Serial2, ATOM_DTU_RS485_RX, ATOM_DTU_RS485_TX, -1, -1);
</code></pre>
<p dir="auto">Which makes sense as I don't understand where the RS485Class is defined or how it is in the below code sample.  Has anyone got this working?</p>
<pre><code>#include &lt;M5Atom.h&gt;
#include &lt;ArduinoModbus.h&gt;
#include &lt;ArduinoRS485.h&gt;
#include "ATOM_DTU_NB.h"

const int numCoils            = 10;
const int numDiscreteInputs   = 10;
const int numHoldingRegisters = 10;
const int numInputRegisters   = 10;

RS485Class RS485(Serial2, ATOM_DTU_RS485_RX, ATOM_DTU_RS485_TX, -1, -1);
</code></pre>
]]></description><link>https://community.m5stack.com/topic/6099/m5-rs485-modbus-slave-sample-code-does-not-compile</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 23:52:26 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6099.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 17 Feb 2024 02:02:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5 RS485 Modbus slave sample code does not compile on Wed, 03 Jul 2024 20:10:15 GMT]]></title><description><![CDATA[<p dir="auto">I'm having the same problem testing a similar example in <a href="https://github.com/m5stack/ATOM_DTU_LoRaWAN/blob/master/examples/Modbus/ModBus-RTU/Slave/Slave.ino" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/ATOM_DTU_LoRaWAN/blob/master/examples/Modbus/ModBus-RTU/Slave/Slave.ino</a></p>
<p dir="auto">Does anyone have a working example to share?</p>
]]></description><link>https://community.m5stack.com/post/25744</link><guid isPermaLink="true">https://community.m5stack.com/post/25744</guid><dc:creator><![CDATA[robertoubeperuzzo]]></dc:creator><pubDate>Wed, 03 Jul 2024 20:10:15 GMT</pubDate></item><item><title><![CDATA[Reply to M5 RS485 Modbus slave sample code does not compile on Sat, 17 Feb 2024 15:02:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a> yup, all the libraries in the include section are downloaded and the compiler does not throw any missing file errors</p>
]]></description><link>https://community.m5stack.com/post/23863</link><guid isPermaLink="true">https://community.m5stack.com/post/23863</guid><dc:creator><![CDATA[LukeS]]></dc:creator><pubDate>Sat, 17 Feb 2024 15:02:56 GMT</pubDate></item><item><title><![CDATA[Reply to M5 RS485 Modbus slave sample code does not compile on Sat, 17 Feb 2024 07:52:42 GMT]]></title><description><![CDATA[<p dir="auto">Have you downloaded and installed all the libraries required in arduino?</p>
]]></description><link>https://community.m5stack.com/post/23858</link><guid isPermaLink="true">https://community.m5stack.com/post/23858</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sat, 17 Feb 2024 07:52:42 GMT</pubDate></item></channel></rss>