<?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[analogRead on M5Atom]]></title><description><![CDATA[<p dir="auto">Hello, I'm trying to make analog readings on pin "G33" and "G23".</p>
<ul>
<li>When I do analogRead(33), I get the same values whatever I send the signal on G33 or G23</li>
<li>When I do analogRead(23), I receive no signal on G33 and G23</li>
</ul>
<p dir="auto">What am I missing?</p>
<p dir="auto">#if !defined(ARDUINO_M5Stick_C)<br />
#error Wrong target platform (M5StickC - M5Atom)<br />
#endif</p>
<p dir="auto">#include "M5Atom.h"<br />
#include "pixelTypes.h"</p>
<p dir="auto">uint8_t pinNorth = 33;<br />
//uint8_t pinSouth = 19;</p>
<p dir="auto">void setup()<br />
{<br />
M5.begin(false, false, true);<br />
Serial.begin(115200);<br />
}</p>
<p dir="auto">void loop()<br />
{<br />
int readValue;<br />
int ledValue;</p>
<p dir="auto">// Read the North pin<br />
readValue = analogRead(pinNorth);<br />
ledValue = map(readValue, 0, 4095, 0, 255);<br />
Serial.print("- North: ");<br />
Serial.print(readValue);<br />
Serial.print(" -&gt; ");<br />
Serial.println(ledValue);</p>
<p dir="auto">M5.dis.drawpix(2, ledValue);<br />
M5.dis.drawpix(6, ledValue);<br />
M5.dis.drawpix(7, ledValue);<br />
M5.dis.drawpix(8, ledValue);</p>
<p dir="auto">delay(10);</p>
<p dir="auto">// Read the South pin<br />
//  readValue = analogRead(pinSouth);<br />
//  ledValue = map(readValue, 0, 4095, 0, 255);<br />
//<br />
//  Serial.print("- South: ");<br />
//  Serial.print(readValue);<br />
//  Serial.print(" -&gt; ");<br />
//  Serial.println(ledValue);<br />
//<br />
//  M5.dis.drawpix(16, ledValue);<br />
//  M5.dis.drawpix(17, ledValue);<br />
//  M5.dis.drawpix(18, ledValue);<br />
//  M5.dis.drawpix(22, ledValue);<br />
//<br />
//  Serial.println("");<br />
//  delay(10);<br />
}</p>
]]></description><link>https://community.m5stack.com/topic/2437/analogread-on-m5atom</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Mar 2026 14:39:14 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2437.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 02 Nov 2020 18:50:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to analogRead on M5Atom on Fri, 13 Nov 2020 20:51:08 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/510">@sbollaerts</a></p>
<p dir="auto">there is only one analog input available on the M5Atom Matrix: GPIO34 which is shared with GPIO23.</p>
<p dir="auto">Please check out <a href="https://docs.m5stack.com/#/en/core/atom_matrix" target="_blank" rel="noopener noreferrer nofollow ugc">M5AtomMatrix Schematic</a></p>
<p dir="auto">In order to use the analog input you'll need to set GPIO34 as input and disable pullup/pulldown resistors of GPIO23.</p>
<p dir="auto">Below code works for me:</p>
<pre><code>#include &lt;M5Atom.h&gt;

void setup()
{
  M5.begin(true, false, true);

  pinMode(GPIO_NUM_34, INPUT);
  gpio_pulldown_dis(GPIO_NUM_23);
  gpio_pullup_dis(GPIO_NUM_23);
}

void loop()
{
  Serial.printf("GPIO34: %d\n", analogRead(GPIO_NUM_34));
  delay(1000);
}
</code></pre>
<p dir="auto">Update: I just realised that GPIO33 can also be used as analog input.</p>
<pre><code>  pinMode(GPIO_NUM_33, INPUT);
  Serial.printf("GPIO33: %d\n", analogRead(GPIO_NUM_33));
</code></pre>
<p dir="auto">Cheers<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/10590</link><guid isPermaLink="true">https://community.m5stack.com/post/10590</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Fri, 13 Nov 2020 20:51:08 GMT</pubDate></item><item><title><![CDATA[Reply to analogRead on M5Atom on Mon, 02 Nov 2020 20:53:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/510">@sbollaerts</a></p>
<p dir="auto">Are you usiing a gpio that does not have a ADC?</p>
<p dir="auto">Ah yes GPIO19 is not an ADC pin.<br />
here is a picture of the pins of the M5Stack<br />
<a href="https://www.instructables.com/Automation-With-SIM800L-ESP32-M5Stack/" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.instructables.com/Automation-With-SIM800L-ESP32-M5Stack/</a><br />
PINS 35 or 36 are the ADC's</p>
<p dir="auto">/</p>
]]></description><link>https://community.m5stack.com/post/10580</link><guid isPermaLink="true">https://community.m5stack.com/post/10580</guid><dc:creator><![CDATA[AndyT]]></dc:creator><pubDate>Mon, 02 Nov 2020 20:53:04 GMT</pubDate></item></channel></rss>