<?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[Assistance Request: M5Core2 and 4-Relay Unit]]></title><description><![CDATA[<p dir="auto">Good morning! I am trying to perform a simple test by flashing the LEDs and cycling the relays on a 4-relay unit board, and for some reason, the magic isn't happening, below is my code:</p>
<pre><code>#include &lt;M5Core2.h&gt;
#include "Unit_4RELAY.h"


UNIT_4RELAY relay;

void setup() {

  // Init M5Core2 And the I2C port(21,22).
  M5.begin(true,false,true,true);             

 // Draw screen
  M5.Lcd.setCursor(0, 10);
  M5.lcd.setTextSize(2);
  M5.lcd.setTextColor(GREEN);
  M5.Lcd.printf("Hello World!");

  // Relay
  relay.Init(1);

      
  
  
}

void loop() {


     relay.relayAll(1);
     relay.ledAll(1);

     delay(2500);

     relay.relayAll(0);
     relay.ledAll(0);
}
</code></pre>
<p dir="auto">Any reason as to why this wouldn't work? The device is plugged into Port A on the M5Core2. Additionally, using wire scan, I am able to detect the device successfully on the I2C bus. I based my code off of this:</p>
<p dir="auto"><a href="https://github.com/m5stack/M5Unit-RELAY/blob/master/examples/Unit_4RELAY_M5Core2/Unit_4RELAY_M5Core2.ino" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Unit-RELAY/blob/master/examples/Unit_4RELAY_M5Core2/Unit_4RELAY_M5Core2.ino</a></p>
<p dir="auto">Additionally, this is the specific module I am using:</p>
<p dir="auto"><a href="https://shop.m5stack.com/products/4-relay-unit" target="_blank" rel="noopener noreferrer nofollow ugc">https://shop.m5stack.com/products/4-relay-unit</a></p>
<p dir="auto">Thanks in advance!</p>
]]></description><link>https://community.m5stack.com/topic/6456/assistance-request-m5core2-and-4-relay-unit</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 23:11:21 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6456.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 11 May 2024 13:54:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Assistance Request: M5Core2 and 4-Relay Unit on Sat, 11 May 2024 17:51:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a></p>
<p dir="auto">Thanks for the help! I've got it working now :)</p>
]]></description><link>https://community.m5stack.com/post/25189</link><guid isPermaLink="true">https://community.m5stack.com/post/25189</guid><dc:creator><![CDATA[wanderingchimp]]></dc:creator><pubDate>Sat, 11 May 2024 17:51:47 GMT</pubDate></item><item><title><![CDATA[Reply to Assistance Request: M5Core2 and 4-Relay Unit on Sat, 11 May 2024 16:03:01 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/wanderingchimp" aria-label="Profile: wanderingchimp">@<bdi>wanderingchimp</bdi></a></p>
<p dir="auto">the example is missing a <code>relay.begin()</code> call before the <code>relay.init()</code>. I've created a <a href="https://github.com/m5stack/M5Unit-RELAY/pull/3" target="_blank" rel="noopener noreferrer nofollow ugc">PR</a> for that.</p>
<p dir="auto">Also for me it only works if I call <code>relayAll()</code> only. If I call both <code>relayAll()</code> and <code>ledAll()</code> as in your example it doesn't work for me.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/25188</link><guid isPermaLink="true">https://community.m5stack.com/post/25188</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Sat, 11 May 2024 16:03:01 GMT</pubDate></item></channel></rss>