Debounced Switch

Properties

Property Description

Disabled

To disable or enable this block.

Name

The name of this block.

Invert

Invert the output

Pin

Pin number; specify as: D<number>.
For example: D12

Comment

To optionally enter a comment.
It does not impact the generated firmware.

Digital input is commonly used to detect the state of switches and buttons. This block also includes the debouncing (See also: Debounce) of the switch or button.

Example
  • the switch has the 'name': 'sw1'

  • and connected to 'port' 'D11' (or any other port you chose)

  • use the current value of 'sw1' in a rule, for example

  • set a LED on when sw1 is on: "if ( sw1 ) { led1 = 1 ; } else { led1 = 0 ;}"