<?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[PaHub: Arduino code for setting port HIGH or LOW]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I'm new to arduino, not new to programming. I have the M5stack, Pa.Hub and a Grove Relay connected together.</p>
<p dir="auto">The example provided on PaHUB is not very clear to me. It shows how to read values but there are no examples for writing values on a specific port of the hub, I can write directly through the I/O pins. However, grove is something new to me.</p>
<p dir="auto">Was looking and looking but could not find a syntax example, the closest that I could find was this one: <a href="https://forum.m5stack.com/topic/1701/solved-connecting-3-env-units-via-1-to-3-hub-to-m5-stack/8" target="_blank" rel="noopener noreferrer nofollow ugc">https://forum.m5stack.com/topic/1701/solved-connecting-3-env-units-via-1-to-3-hub-to-m5-stack/8</a></p>
<p dir="auto"><strong>Question:</strong><br />
How are you connecting to the Pa.HUB and accessing your grove extensions from there?</p>
<p dir="auto">I just need to turn the voltage HIGH and LOW.</p>
<p dir="auto">Many thanks in advance!</p>
]]></description><link>https://community.m5stack.com/topic/1894/pahub-arduino-code-for-setting-port-high-or-low</link><generator>RSS for Node</generator><lastBuildDate>Fri, 08 May 2026 04:16:24 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/1894.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 Apr 2020 14:20:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to PaHub: Arduino code for setting port HIGH or LOW on Sun, 26 Apr 2020 01:13:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maxbrito" aria-label="Profile: maxbrito">@<bdi>maxbrito</bdi></a> Glad to hear that. Yes, sometimes the documentations are not enough especially for people new to M5.</p>
]]></description><link>https://community.m5stack.com/post/8369</link><guid isPermaLink="true">https://community.m5stack.com/post/8369</guid><dc:creator><![CDATA[liemph]]></dc:creator><pubDate>Sun, 26 Apr 2020 01:13:39 GMT</pubDate></item><item><title><![CDATA[Reply to PaHub: Arduino code for setting port HIGH or LOW on Sat, 25 Apr 2020 16:17:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/liemph" aria-label="Profile: liemph">@<bdi>liemph</bdi></a> said in <a href="/post/8359">PaHub: Arduino code for setting port HIGH or LOW</a>:</p>
<blockquote>
<p dir="auto">Port B of your M5Stack.</p>
</blockquote>
<p dir="auto">Thank you so much for explaining. It worked, hooray!! :-)</p>
<p dir="auto">Just to help other newbies reading this topic in the future, Port B of the M5Stack is the black port on the device and is only available when you get the base with the battery (Plus). On previous devices this was clearly marked, but it is not the case on this model.</p>
<p dir="auto">Then, all you need to do is to use I/O pin 26 on your code. The syntax code provided on "Examples -&gt; M5Stack -&gt; Unit -&gt; Relay" has worked perfectly without modification.</p>
<pre><code>#include &lt;M5Stack.h&gt;

void setup() {
  M5.begin();
  M5.Power.begin();
  M5.Lcd.clear(BLACK);
  M5.Lcd.setTextFont(4);
  M5.Lcd.setTextColor(YELLOW, BLACK);
  M5.Lcd.setCursor(50, 0, 4);
  M5.Lcd.println(("Relay Example"));
  //disable the speak noise
  dacWrite(25, 0);
  pinMode(26, OUTPUT);
}

void loop(void) {
  digitalWrite(26, HIGH);
  delay(2500);
  digitalWrite(26, LOW);
  delay(2500);
}
</code></pre>
<p dir="auto">Again, thank you.</p>
]]></description><link>https://community.m5stack.com/post/8362</link><guid isPermaLink="true">https://community.m5stack.com/post/8362</guid><dc:creator><![CDATA[maxbrito]]></dc:creator><pubDate>Sat, 25 Apr 2020 16:17:58 GMT</pubDate></item><item><title><![CDATA[Reply to PaHub: Arduino code for setting port HIGH or LOW on Sat, 25 Apr 2020 15:01:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maxbrito" aria-label="Profile: maxbrito">@<bdi>maxbrito</bdi></a> PaHub Unit is for using multiple I2C Units with identical addresses. You should be aware that not every I2C unit is a simple array of pins (port) which you can set High or Low. For example, the link you mentioned is ENV units and of course, there is no way to treat them as a port where you can set High or Low. You just get the temperature etc values from them.</p>
<p dir="auto">Consider using PbHub. However, if your relay unit is ONLY one then you do not need PbHub (and PaHub), just connect your relay unit (grove) to Port B of your M5Stack.</p>
]]></description><link>https://community.m5stack.com/post/8359</link><guid isPermaLink="true">https://community.m5stack.com/post/8359</guid><dc:creator><![CDATA[liemph]]></dc:creator><pubDate>Sat, 25 Apr 2020 15:01:23 GMT</pubDate></item></channel></rss>