Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diyables_micropython_button-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file diyables_micropython_button-0.1.0.tar.gz.

File metadata

File hashes

Hashes for diyables_micropython_button-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b1996de67d5f8f03f93d812a48a8244346b5b7ee1702b915ea55222ec018720f
MD5 50d23897e066982c3e183b6ddfef8672
BLAKE2b-256 fe1206d4e6af07c3bb3c3412938085da7ea84bc28f44fcbc7209b3fbf20d55e6

See more details on using hashes here.

File details

Details for the file DIYables_MicroPython_Button-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for DIYables_MicroPython_Button-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a67453f3b44aa25cf5423cb12d3c15903b9f280d392c1e7c56f25b5d7d5e4f50
MD5 10ae090e63ad25fcf19704d4389ebfff
BLAKE2b-256 de36251eaaa307f45ea80561362259def9df0f7733958f6e6ed20dfe25725070

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page