MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

MMM-Buttons only working with the first button



  • Hi!

    I set up MMM-Buttons with one button attached to pin 17. It all worked just fine.
    But now I want to have five buttons, so I attached another four. These don’t work, only the first one…

    I’ve configured the module like this:

    
    			{
    
    			    module: 'MMM-Buttons',
    
    			    config: {
    
    			        buttons: [
    
    			            {
    
    			                pin: 17,
    
    			                name: "Tom",
    
    			                shortPress: {
    
    			                    notification: "CURRENT_PROFILE",
    
    			                    payload: "Tom"
    
    			                },
    
    
    
    			            },
    					{
    
    			                pin: 27,
    
    			                name: "Alice",
    
    			                shortPress: {
    
    			                    notification: "CURRENT_PROFILE",
    
    			                    payload: "Alice"
    
    			                },
    
    
    
    			            },
    					{
    
    			                pin: 22,
    
    			                name: "default",
    
    			                shortPress: {
    
    			                    notification: "CURRENT_PROFILE",
    
    			                    payload: "default"
    
    			                },
    
    
    
    			            },
    					{
    
    			                pin: 18,
    
    			                name: "Jimmy",
    
    			                shortPress: {
    
    			                    notification: "CURRENT_PROFILE",
    
    			                    payload: "Jimmy"
    
    			                },
    
    
    
    			            },
    					{
    
    			                pin: 15,
    
    			                name: "Max",
    
    			                shortPress: {
    
    			                    notification: "CURRENT_PROFILE",
    
    			                    payload: "Max"
    
    			                },
    
    
    
    			            }
    
    
    
    			        ]
    
    			    }
    
    },
    	
    

    Thanks for helping!

    Edit: The button clicks don’t get registered…



  • first check you wiring and make sure you connect the circut perfictly. secondly, try to work button by button see how it goes.

    check your buttons by trying this python script on python idle
    https://raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/
    then add your other buttons then check them if they give you the alert after that check back on magic mirror.


  • Project Sponsor

    I’m not sure, but I think you have to define the longpress option for each button

    			{
    			    module: 'MMM-Buttons',
    			    config: {
    			        buttons: [
    			            {
    			                pin: 17,
    			                name: "Tom",
    			                shortPress: {
    			                    notification: "CURRENT_PROFILE",
    			                    payload: "Tom"
    			                },
                                            longPress: undefined
    			            },
    					{
    			                pin: 27,
    			                name: "Alice",
    			                shortPress: {
    			                    notification: "CURRENT_PROFILE",
    			                    payload: "Alice"
    			                },
                                           longPress: undefined
    			            },
    					{
    			                pin: 22,
    			                name: "default",
    			                shortPress: {
    			                    notification: "CURRENT_PROFILE",
    			                    payload: "default"
    			                },
                                           longPress: undefined
    			            },
    					{
    			                pin: 18,
    			                name: "Jimmy",
    			                shortPress: {
    			                    notification: "CURRENT_PROFILE",	
    		                    payload: "Jimmy"
    			                },
                                         longPress: undefined
    			            },
    					{
    			                pin: 15,
    		                        name: "Max",
    			                shortPress: {
    			                    notification: "CURRENT_PROFILE",
      		                           payload: "Max"
    			                },
                                         longPress: undefined
    			            }
    			        ]
    			    }
    },
    


  • @broberg thats what I though also


  • Project Sponsor

    Also make sure you are using a pull-down resistor with each button to avoid a floating status of the GPIO pin. I currently have no link at hand, but if you search the forum or Google you‘ll find a scheme how wire the pull-down.


Log in to reply