Minecraft command block execute when button goes up

minecraft-commandsminecraft-java-edition

I want to connect a button to a command block, and execute a toggle command when the button goes "off"

In Javascript terms, I want to execute a command "onMouseUp"

Command blocks only seem to execute when they are turned on. How do you make a command block execute a callback operation when the block is turned off?

Best Answer

Place a redstone torch between the button and the command block.