MicroPython Library for Button, created by DIYables
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file DIYables_MicroPython_Button-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: DIYables_MicroPython_Button-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a67453f3b44aa25cf5423cb12d3c15903b9f280d392c1e7c56f25b5d7d5e4f50 |
|
MD5 | 10ae090e63ad25fcf19704d4389ebfff |
|
BLAKE2b-256 | de36251eaaa307f45ea80561362259def9df0f7733958f6e6ed20dfe25725070 |