Skip to main content

MicroPython Button Library - DIYables_MicroPython_Button

This MicroPython library is designed for any hardware plaform that supports MicroPython such as Raspberry Pi Pico, ESP32, Micro:bit... to make it easy to use push button, momentary switches, toggle switch, magnetic contact switch (door sensor)... It is easy to use for not only beginners but also experienced users...

It is created by DIYables to work with DIYables products, but also work with products from other brands. Please consider purchasing products from DIYables Store on Amazon from to support our work.

Features

  • Works with any hardware plaform that supports MicroPython such as Raspberry Pi Pico, ESP32, Micro:bit...
  • Supports the internal pull-up/pull-down resistor to avoid the floating value
  • Supports debounce to eliminate the chattering phenomenon
  • Supports the pressed and released events
  • Supports the counting (for FALLING, RISING and BOTH)
  • Easy to use with multiple buttons
  • All functions are non-blocking

Available Functions

  • __init__(pin, mode=Pin.PULL_UP)
  • set_debounce_time(time_ms)
  • get_state()
  • get_state_raw()
  • is_pressed()
  • is_released()
  • set_count_mode(mode)
  • get_count()
  • reset_count()
  • loop()

Available Examples

  • pull_up.py
  • pull_down.py

Tutorials

References

Release files for DIYables-MicroPython-Button 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DIYables-MicroPython-Button 0.1.0
File Size Uploaded
diyables_micropython_button-0.1.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for DIYables-MicroPython-Button 0.1.0
File Interpreter ABI Platform
DIYables_MicroPython_Button-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / diyables_micropython_button-0.1.0.tar.gz

Download URL diyables_micropython_button-0.1.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b1996de67d5f8f03f93d812a48a8244346b5b7ee1702b915ea55222ec018720f
BLAKE2b-256 checksum
How to use checksums
fe1206d4e6af07c3bb3c3412938085da7ea84bc28f44fcbc7209b3fbf20d55e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / DIYables_MicroPython_Button-0.1.0-py3-none-any.whl

Download URL DIYables_MicroPython_Button-0.1.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a67453f3b44aa25cf5423cb12d3c15903b9f280d392c1e7c56f25b5d7d5e4f50
BLAKE2b-256 checksum
How to use checksums
de36251eaaa307f45ea80561362259def9df0f7733958f6e6ed20dfe25725070
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page