Here is a button
node from xod/common-hardware
.
Take a look at button outputs. It has a PRS
pin, which is true whenever it is pressed. And DONE
pin, which pulses when reading is done, wherever the button is pressed or not.
This is a standard idiom for side-effect nodes representing hardware or, for example, the Internet.
↓ Download as a Fritzing project
Let’s make the LED glow while the button is pressed.
PORT
value of the button
node to D13
because it’s connected to the board’s digital port 13.PRS
to LUM
.Hold the button to turn the LED on.
Place the already familiar node flip-flop
between button
and led
to switch the LED on or off on each press.