<?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[GPIO in MMM: ModuleToggle with MMM-Buttons is randomly working]]></title><description><![CDATA[<p dir="auto">Issue comes from the buttons requiring an insane amount of presses to trigger, sometimes never triggering, and on rare occasions 2 of the 4 will work perfectly.</p>
<p dir="auto">The goal was to have an easy way to have buttons, in this case 4, and each have  their certain modules.<br />
Using code from <a href="http://razzpisampler.oreilly.com/ch07.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://razzpisampler.oreilly.com/ch07.html</a></p>
<pre><code>import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)

GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)

while True:
    input_state = GPIO.input(18)
    if input_state == False:
        print('Button Pressed')
        time.sleep(0.2)

</code></pre>
<p dir="auto">I tested each one button with their own GPIO and each worked every time, so with this knowledge i know the buttons and the wiring is right.</p>
<p dir="auto">The code for the config is:</p>
<pre><code> modules: [
                {
                module: 'MMM-ModuleToggle',
                config: {
                hide: ["clock"]
                    }
                },
                {
                  module: 'MMM-Buttons',
                    config: {
                        buttons: [
                            {
                                pin: 23,
                                name: "Button_One",
                                shortPress: {
                                    notification: "MODULE_TOGGLE",
                                    payload: {hide: [], show: ["calendar", "clock"], toggle:[]}
                                },
                                longPress: undefined
                            },
                            {
                                pin: 13,
                                name: "Button_Two",
                                shortPress: {
                                    notification: "MODULE_TOGGLE",
                                    payload:  {hide: ["calendar", "clock"], show: [], toggle:[]}
                                },
                                longPress:  undefined
                            }
                        ]
                    }

</code></pre>
<p dir="auto">As stated they work, but at very random time.</p>
<p dir="auto">Im wondering if im suppose to like preload the knowledge to use GPIO ahead of the booting of the actual Magic Mirror program, or something like, or am i missing a step.</p>
<p dir="auto">Thank you in advance.</p>
]]></description><link>https://forum.magicmirror.builders/topic/6620/gpio-in-mmm-moduletoggle-with-mmm-buttons-is-randomly-working</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 19:21:27 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/6620.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Feb 2018 13:31:09 GMT</pubDate><ttl>60</ttl></channel></rss>