Button

../../../../_images/button_b.png

Overview

Press-type switch digital input module. Pressing outputs a high level, releasing outputs a low level.

Technical Specifications

Operating voltage: VCC 3.3V -5V

Module dimensions: 24*48mm

Mounting: 2 plastic building block compatible through-holes

Data type: Pressed–1 Released–0

Pin Definition

Pin

Definition

GND

Ground

VCC

Power

DO

Digital output

NC

Not connected

Example Code

Graphical code

../../../../_images/button.png
T = None

from mpython import *

p0 = MPythonPin(0, PinMode.IN)

def boolean_P0():
    return p0.read_digital() == 1
T = 0
while True:
    if boolean_P0():
        T = T + 1
    oled.fill(0)
    oled.DispChar(str(str('Press count: ') + str((str(T)))), 0, 0, 1)
    oled.show()
../../../../_images/button_1.png