Connected Little Sandwich Box – Button

Added a button so that I can make the box do something. On the WEMOS the button sits between D5 and D0 – they are adjacent pins.

Commands

You need to activate the button as follows:

pushbuttonfitted=yes

These commands will change the colour on press and release:

{"process":"pixels", "command":"setnamedcolour", "colourname":"blue", "sensor":"button", "trigger":"pressed"}
{"process":"pixels", "command":"setnamedcolour", "colourname":"green", "sensor":"button", "trigger":"released"}

Make sure you do the pressed command first, otherwise it errors.

Triggering remote boxes

{"process":"pixels", "command":"setnamedcolour", "colourname":"red", "sensor":"button", "trigger":"pressed", "to":"lb/command/CLB-d1f6de"}
{"process":"pixels", "command":"setnamedcolour", "colourname":"purple", "sensor":"button", "trigger":"released", "to":"lb/command/CLB-d1f6de"}

Managing triggers

To find out what triggers your box has, type listeners

To clear the triggers, type clear listeners

Leave a Reply

Your email address will not be published. Required fields are marked *