Ever have a momentary switch that you would like to use to toggle something? Like for example, press it once and the light comes on, press it again and the light goes off? You could add some extra circuitry to do this, or you could just use the Afero “Is Toggle” property of GPIOs.
Normally when you configure a GPIO as an input, the attribute value follows the pin state. So when you push your momentary switch, the pin goes high and the attribute value becomes 1. When you let go, the pin goes low and the attribute value goes back to 0. If you are using the attribute value to drive a light, the light will only be on as long as your finger is on the button.
Enter the Is Toggle property. In the Afero Profile Editor, just click the Is Toggle option for your GPIO configuration. This lets us know that what you really want is for the attribute value to toggle each time you press the momentary switch. So now when the input pin goes high, we change the attribute value from 0 to 1. When the pin goes low we do nothing. When the pin goes high again, we change the attribute value from 1 back to 0. And now your momentary switch has become a toggle with no additional circuitry.
This becomes even cooler when you bind the input to an output. I’ll talk about that in a future post.