Jump to content

Brick MQTT Proxy - LCD20x4 How to Button Control


Recommended Posts

It's a bit tricky. You could use the is_button_pressed() function to poll for button presses in the MQTT proxy. But it's easy to miss button presses this way.


So you'd need to use the button_pressed and button_released callbacks. But currently there is no callback handling like this in the proxy.


As an example, I've added a new button_pressed topic for the LCD Bricklets, that is fed via the button_pressed and button_released callbacks. Have a look at the latest Brick MQTT Proxy version on github.

Link to comment
Share on other sites

Have tested and is working fine. Thanks.


To check by the application which button is pressed, the JSON string is parsed. The keys checked are "0": ... "3":.

The only caution is that the JSON string does not contain the word Button or LCD20x4, so in case "0": ... "3": are also used for other messages then a conflict is the result.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...