<?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[Arduino M5Core2 Buttons]]></title><description><![CDATA[<p dir="auto">I'm having trouble understanding how to use the M5Stack Core2, creating new buttons for my project.</p>
<p dir="auto">I can use the 3 buttons (A, B &amp; C) and for some screens, I need two more buttons, with similar properties.</p>
<p dir="auto">I've been studying the Example:  events_buttons_gestures_rotation.ino but I can't make heads or tails of it.   I've added print statements to see which subroutines are executed and I don't understand what the "doRotation()" or what the swipe gestures do.</p>
<p dir="auto">The only thing that I've discovered in playing with it is that if I press one of the buttons twice quickly that the "toggleColor" is executed.</p>
<p dir="auto">The few comments are useless to me.</p>
<p dir="auto">Is there a simpler example somewhere that I can use to create a few buttons when I need them for the "wasReleased()" and "wasPressedFor()" functions?</p>
<p dir="auto">Sir Michael</p>
]]></description><link>https://community.m5stack.com/topic/7156/arduino-m5core2-buttons</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 04:46:57 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7156.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Jan 2025 00:29:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Arduino M5Core2 Buttons on Mon, 06 Jan 2025 01:28:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sirmichael" aria-label="Profile: SirMichael">@<bdi>SirMichael</bdi></a></p>
<p dir="auto">I found what I was looking for, a simple sketch to create a button.  I did some minor massages, taking from the events_buttons_gestures_rotation.ino and figured it out.</p>
<pre><code>#include &lt;M5Core2.h&gt;

ButtonColors on_clrs = { RED, WHITE, WHITE };
ButtonColors off_clrs = { BLACK, WHITE, WHITE };
Button myButton(10, 10, 80, 60, false, "Button", off_clrs, on_clrs, TL_DATUM );

void setup() {
  M5.begin();
  M5.Buttons.draw();
}

void loop() {  
  M5.update();
  if (myButton.wasReleased()) Serial.print("* ");
  
}
</code></pre>
<p dir="auto">Sir Michael</p>
]]></description><link>https://community.m5stack.com/post/27760</link><guid isPermaLink="true">https://community.m5stack.com/post/27760</guid><dc:creator><![CDATA[SirMichael]]></dc:creator><pubDate>Mon, 06 Jan 2025 01:28:21 GMT</pubDate></item></channel></rss>