<?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[M5Unit 8Servos - push button input]]></title><description><![CDATA[<p dir="auto">Hello everybody</p>
<p dir="auto">I would like to use this unit as push button extension. In the examples codes i saw that this module can handle input and output. But there is no description if pins are already debounced and no schematic how the button should be connected is provided.<br />
Does anybody know how to manage this?</p>
]]></description><link>https://community.m5stack.com/topic/6508/m5unit-8servos-push-button-input</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Mar 2026 05:00:42 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6508.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 May 2024 20:07:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5Unit 8Servos - push button input on Sat, 01 Jun 2024 16:20:13 GMT]]></title><description><![CDATA[<p dir="auto">I've managed to read button clicks from M5Unit 8Servos.</p>
<p dir="auto">Here is how i connected the button to the unit.<br />
<img src="/assets/uploads/files/1717258536984-img_1089.jpg" alt="IMG_1089.JPG" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1717258536750-img_1090.jpg" alt="IMG_1090.JPG" class=" img-fluid img-markdown" /></p>
<p dir="auto">I've managed to read button click from M5Unit 8Servos with this code.<br />
I'm using an M5Stack AtomS3 Lite.</p>
<pre><code>#include &lt;Arduino.h&gt;
#include &lt;M5Unified.h&gt;
#include &lt;Wire.h&gt;
#include &lt;M5_UNIT_8SERVO.h&gt;

#define SERVO_PIN 0
#define START_BUTTON_PIN 1

// put variables here:
M5_UNIT_8SERVO unit_8servo;
bool btnState;
unsigned long btnClieckedMs;

// put function declarations here:

void setup() {
  M5.begin();
  Serial.begin(115200);

  Serial.println("### Setup - start");

  while (!unit_8servo.begin(&amp;Wire, G2, G1, M5_UNIT_8SERVO_DEFAULT_ADDR)) {
    Serial.println("extio Connect Error");
    delay(100);
  }

  //unit_8servo.setAllPinMode(SERVO_CTL_MODE);
  unit_8servo.setOnePinMode(SERVO_PIN, SERVO_CTL_MODE);
  unit_8servo.setOnePinMode(START_BUTTON_PIN, DIGITAL_INPUT_MODE);
  
  btnState = false;

  Serial.println("### Setup - end");
}

void loop() {
  bool prevBtnState = btnState;                               // save last state for comparison
  btnState = unit_8servo.getDigitalInput(START_BUTTON_PIN);   // read new state

  if(prevBtnState == false &amp;&amp; btnState == true) {             // if state has changed
    btnClieckedMs = millis();                                 // save millis
  } else if(prevBtnState == true &amp;&amp; btnState == false) {      // if state has changed again
    if(millis() - btnClieckedMs &gt; 50) {                       // check how long it took from 'false' to 'true' (debounce)
      Serial.print("Button clicked ");                        // do some fancy things when button clicked 
      Serial.println(btnClieckedMs);                      
    }
  }
}
</code></pre>
]]></description><link>https://community.m5stack.com/post/25452</link><guid isPermaLink="true">https://community.m5stack.com/post/25452</guid><dc:creator><![CDATA[swasi]]></dc:creator><pubDate>Sat, 01 Jun 2024 16:20:13 GMT</pubDate></item><item><title><![CDATA[Reply to M5Unit 8Servos - push button input on Mon, 27 May 2024 20:16:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/443">@ajb2k3</a> thank you very much for your suggestion.</p>
<p dir="auto">I think i should pull out my multimeter and check what happens, if i configure the port as input.<br />
Maybe I'll find out, how it's working.</p>
<p dir="auto">The M5buttons schematics shows how to debounce the button input. Thank you very much for this picture.</p>
]]></description><link>https://community.m5stack.com/post/25415</link><guid isPermaLink="true">https://community.m5stack.com/post/25415</guid><dc:creator><![CDATA[swasi]]></dc:creator><pubDate>Mon, 27 May 2024 20:16:45 GMT</pubDate></item><item><title><![CDATA[Reply to M5Unit 8Servos - push button input on Sun, 26 May 2024 07:52:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/6926">@swasi</a> Do Not connect it to V and S as it will destroy the input pins.<br />
V is at 5V but the I/O pins only accept 3.3V.<br />
You need to use a circuit like this (the M5stack buttons)<br />
<img src="https://static-cdn.m5stack.com/resource/docs/products/unit/button/button_sch_01.webp" alt="alt text" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/25403</link><guid isPermaLink="true">https://community.m5stack.com/post/25403</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sun, 26 May 2024 07:52:53 GMT</pubDate></item><item><title><![CDATA[Reply to M5Unit 8Servos - push button input on Sun, 26 May 2024 05:56:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/7508">@teastain</a> yes, exactly this unit.</p>
<p dir="auto">My push button is a cheap metal 1NO push button from aliexpress<br />
<a href="https://de.aliexpress.com/item/4000962003511.html?spm=a2g0o.productlist.main.29.28681ZX81ZX8eV&amp;algo_pvid=980580c4-cbbf-4562-8505-6208e49f88f1&amp;algo_exp_id=980580c4-cbbf-4562-8505-6208e49f88f1-14&amp;pdp_npi=4%40dis%21CHF%211.57%211.57%21%21%211.68%211.68%21%402103010b17167024952887064e1da1%2110000012730074410%21sea%21CH%212358164638%21&amp;curPageLogUid=D8W0ybIwBZDH&amp;utparam-url=scene%3Asearch%7Cquery_from%3A" target="_blank" rel="noopener noreferrer nofollow ugc">https://de.aliexpress.com/item/4000962003511.html?spm=a2g0o.productlist.main.29.28681ZX81ZX8eV&amp;algo_pvid=980580c4-cbbf-4562-8505-6208e49f88f1&amp;algo_exp_id=980580c4-cbbf-4562-8505-6208e49f88f1-14&amp;pdp_npi=4%40dis!CHF!1.57!1.57!!!1.68!1.68!%402103010b17167024952887064e1da1!10000012730074410!sea!CH!2358164638!&amp;curPageLogUid=D8W0ybIwBZDH&amp;utparam-url=scene%3Asearch|query_from%3A</a></p>
<p dir="auto">My idea is to connect it to one port of the M5Unit 8Servos.</p>
<p dir="auto">The example on github is here.<br />
<a href="https://github.com/m5stack/M5Unit-8Servo/blob/main/examples/DIGITAL_INPUT_OUTPUT/DIGITAL_INPUT_OUTPUT.ino" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Unit-8Servo/blob/main/examples/DIGITAL_INPUT_OUTPUT/DIGITAL_INPUT_OUTPUT.ino</a></p>
<p dir="auto">I don't know if i have to connect the push button between S and G on the 8Servos Unit or between V and S. And i'm wondering if i have to debounce the push button in hardware with an RC filter or it's already done in the unit. Or can i debounce the button in my arduino code?</p>
]]></description><link>https://community.m5stack.com/post/25402</link><guid isPermaLink="true">https://community.m5stack.com/post/25402</guid><dc:creator><![CDATA[swasi]]></dc:creator><pubDate>Sun, 26 May 2024 05:56:51 GMT</pubDate></item><item><title><![CDATA[Reply to M5Unit 8Servos - push button input on Sat, 25 May 2024 21:08:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/6926">@swasi</a> This product?<br />
<a href="https://docs.m5stack.com/en/unit/8Servos%20Unit" target="_blank" rel="noopener noreferrer nofollow ugc">https://docs.m5stack.com/en/unit/8Servos Unit</a><br />
And what button?</p>
]]></description><link>https://community.m5stack.com/post/25398</link><guid isPermaLink="true">https://community.m5stack.com/post/25398</guid><dc:creator><![CDATA[teastain]]></dc:creator><pubDate>Sat, 25 May 2024 21:08:45 GMT</pubDate></item></channel></rss>