11. Button¶

11.1. Introduction¶
Button is a sensor that allow user to physical switch the circuit open or close, so it is commonly use as control component.
11.2. The principle¶
The Button use a simple switch mechanism to control the connection state of circuit. Depending the construction of the button, it will have two normally states. Normally Open push button is one of common use button structure, default states is open circuit, the two terminal not connected each other, cause no current through. After pressed, the two terminal will connected and circuit will be close.

11.3. Specification¶
Operate voltage: 0 - 5V
Interface: Analog
Output voltage: 0 (pressed) / same as Operate voltage (not press)
11.4. Pinout Diagram¶
| Pin | Function |
|---|---|
| G | Ground |
| V | Voltage Supply |
| S | Output (same as Voltage supply) |
11.6. Quick to Start/Sample¶
Connect the sensor to development board (direct plugin or using wire)

Open Makecode, using the https://github.com/smarthon/pxt-smarthome PXT

Use the
When Button at P1 pressedto perform action after pressed the button
11.7. Result¶
When pressed the button, the micro:bit LED will show a heart icon.

