Jopyth / MMM-Buttons

This module can be used to to connect buttons to your Magic Mirror²

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buttons don't work until I test from terminal

gonzonia opened this issue · comments

The plugin works fine for what I'm doing but in order for it to work I have to run a python based test program I have for testing the buttons. Once I do that it all works great. I have to do this every time the pi is rebooted. Any ideas?

This is the python test program

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)

GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)


while True:
    input_state25 = GPIO.input(25)
    input_state24 = GPIO.input(24)
    if input_state25 == False:
        print('Button Pressed 25')
        time.sleep(0.2)
    if input_state24 == False:
        print('Button Pressed 24')
        time.sleep(0.2)

I don't even have to press a button, just load that and then quit and the buttons start working.

I can only get PIN 21 to work